Linux system DNS configuration


Ubuntu

: *
Method a: Modify / etc / network / interfaces, one (separated by spaces between a plurality dns) in its last increase, as

auto lo
iface lo inet loopback
 
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.201.100
netmask 255.255.255.0
gateway 192.168.201.254
dns-nameservers 202.97.224.68 202.97.224.69

Method Two: Modify /etc/resolvconf/resolv.conf.d/base (This file is empty by default)

nameserver 8.8.8.8
nameserver 114.114.114.114

Restart DNS

sudo resolvconf -u

View results

ping  www.baidu.com
cat /etc/resolv.conf

**

CentOS

: **
modify configuration files NetworkManager.conf

vim /etc/NetworkManager/NetworkManager.conf

Add the [main] in

dns=no

Modify the configuration file resolv.conf

vim /etc/resolv.conf

Add to

#主DNS服务器
nameserver 218.85.157.99
 
#备DNS服务器
nameserver 114.114.114.114

Restart NetworkManager

systemctl restart NetworkManager
Published 15 original articles · won praise 0 · Views 284

Guess you like

Origin blog.csdn.net/weixin_44478009/article/details/103868988