ubuntu22.04系统更改完resolv.conf后 重启网络服务后resolv.conf被重置

2023-12-13 03:05:39

  1. vi /etc/systemd/resolved.conf,
    [Resolve]
    DNS=8.8.8.8 114.114.114.114 192.168.4.2

    2.重启域名解析服务
    systemctl restart systemd-resolved
    systemctl enable systemd-resolved

    3.备份当前的/etc/resolve.conf,并重新设置/run/systemd/resolve/resolv.conf 到/etc/resolve.conf的软链接
    mv /etc/resolv.conf /etc/resolv.conf.bak
    ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

    4.查看验证,
    cat /etc/resolv.conf
     
     apt update -y && sudo apt full-upgrade -y  && apt autoremove -y
    

文章来源:https://blog.csdn.net/henanchina/article/details/134801287
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。