Menu Close

设置CentOS 7的DNS

禁用NetworkManager

使用vi打开etc/NetworkManager/NetworkManager.conf,找到下面内容

..
[main]
#plugins=ifcfg-rh,ibft
...

将其更改为

...
[main]
dns=none
#plugins=ifcfg-rh,ibft
...

重启NetworkManager

$ sudo systemctl restart NetworkManager.service

添加DNS服务器地址

打开/etc/resolv.conf 后加入以下内容

# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4

References

  1. https://wiseindy.com/blog/linux/how-to-set-dns-in-centos-rhel-7-prevent-network-manager-from-overwriting-etc-resolv-conf/

发表评论

邮箱地址不会被公开。 必填项已用*标注