Adding DNS addresses into /etc/resolv.conf

来源:互联网 发布:开发者 读书app 知乎 编辑:程序博客网 时间:2024/05/25 23:57


https://askubuntu.com/questions/627899/nameserver-127-0-1-1-in-resolv-conf-wont-go-away


NetworkManager is the program which (via the resolvconf utility) inserts address127.0.1.1 intoresolv.conf. NM inserts that address if an only if it is configured to start an instance of the dnsmasq program to serve as a local forwarding nameserver. That dnsmasq instance listens for queries at address 127.0.1.1.

If you do not want to use a local forwarding nameserver then configure NetworkManager not to start a dnsmasq instance and not to insert that address. In/etc/NetworkManager/NetworkManager.conf comment out the linedns=dnsmasq

sudo nano /etc/NetworkManager/NetworkManager.conf[main]plugins=ifupdown,keyfile,ofono#dns=dnsmasq

and restart the NetworkManager service.

sudo service network-manager restart

In this mode, NetworkManager updates /etc/resolv.conf (still via resolvconf) to include the nameserver addresses NetworkManager has for active connections.

If you want to disable the resolvconf mechanism for updating resolv.conf and just use a static resolv.conf file, do the following.

ls /etc/resolv.conf  -llrwxrwxrwx 1 root root 29 Mar  5 13:45 /etc/resolv.conf -> ../run/resolvconf/resolv.confsudo rm -f /etc/resolv.conf  # Delete the symbolic linksudo nano /etc/resolv.conf   # Create static file# Content of static resolv.confnameserver 8.8.4.4nameserver 8.8.8.8
0 0
原创粉丝点击