Remember a DNS problem in Ubuntu network configuration

/etc/resolv.confIt is generated, if directly modify this, reboot again network services will be covered, according to various online methods, in /etc/network/interfacelast added in dns-nameservers, /etc/resolvconf/resolv.conf.d/basehere baseseems to be tailand head, but have tried many times without success to cover /etc/resolv.confStill not covered

Finally refer to this article: https://www.jianshu.com/p/998a4fc81901
successfully covered and /etc/resolv.confchanged 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/interfacesconfiguration 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.confmanagementsystemd-resolved

systemctl disable --now systemd-resolved.service
rm /etc/resolv.conf

Modify the NetworkManagerconfiguration files /etc/NetworkManager/NetworkManager.confin [main]adding at dns=defaultordns=none

[main]
plugins=ifupdown,keyfile
dns=default
no-auto-default=00:0c:29:07:a0:1d

[ifupdown]
managed=true

Then network-managerrestart 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
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/mochu7777777/article/details/107829497