/etc/resolv.conf
It is generated, if directly modify this, reboot again network services will be covered, according to various online methods, in /etc/network/interface
last added in dns-nameservers
, /etc/resolvconf/resolv.conf.d/base
here base
seems to be tail
and head
, but have tried many times without success to cover /etc/resolv.conf
Still not covered
Finally refer to this article: https://www.jianshu.com/p/998a4fc81901
successfully covered and /etc/resolv.conf
changed the DNS address
My version of ubuntu:
root@ubuntu:/# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.10
Release: 19.10
Codename: eoan
My /etc/network/interfaces
configuration is as follows:
auto lo
iface lo inet loopback
auto ens33
iface ens33 inet static
address 192.168.7.77
netmask 255.255.255.0
gateway 192.168.7.1
network 192.168.7.0
broadcast 192.168.7.255
dns-nameservers 114.114.114.114
Then disable the /etc/resolv.conf
managementsystemd-resolved
systemctl disable --now systemd-resolved.service
rm /etc/resolv.conf
Modify the NetworkManager
configuration files /etc/NetworkManager/NetworkManager.conf
in [main]
adding at dns=default
ordns=none
[main]
plugins=ifupdown,keyfile
dns=default
no-auto-default=00:0c:29:07:a0:1d
[ifupdown]
managed=true
Then network-manager
restart the network by restarting , there are many restart commands:
systemctl restart network-manager
service network-manager restart
/etc/init.d/network-manager restart
Test ping, browser visit website