查看当前网络连接
nmcli connection show NAME UUID TYPE DEVICE eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet eno1
修改当前网络连接对应的DNS服务器
nmcli con mod eth0 ipv4.dns "202.102.152.3 202.102.128.68"
将dns配置生效
nmcli con up eth0
手动方法:
修改 /etc/NetworkManager/NetworkManager.conf 文件,在main部分添加 “dns=none” 选项:
[main] plugins=ifcfg-rh dns=none
NetworkManager重新装载上面修改的配置
systemctl restart NetworkManager.service
手工修改 /etc/resolv.conf,添加:
nameserver 114.114.114.114 nameserver 8.8.8.8