[root@auto-test2 network-scripts]# nmcli connection show
NAME UUID TYPE DEVICE ens160 0bd6ac7c-a5aa-4aef-ad6d-2a62949be537 802-3-ethernet ens160
[root@auto-test2 network-scripts]# nmcli con mod ens160 ipv4.dns "114.114.114.114 8.8.8.8"
[root@auto-test2 network-scripts]# nmcli con up ens160 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2) [root@auto-test2 network-scripts]# ping www.baidu.com
PING www.a.shifen.com (220.181.111.188) 56(84) bytes of data. 64 bytes from 220.181.111.188 (220.181.111.188):
icmp_seq=1 ttl=52 time=2.13 ms 64 bytes from 220.181.111.188 (220.181.111.188):
icmp_seq=2 ttl=52 time=2.04 ms 64 bytes from 220.181.111.188 (220.181.111.188):
icmp_seq=3 ttl=52 time=2.01 ms 64 bytes from 220.181.111.188 (220.181.111.188):
icmp_seq=4 ttl=52 time=3.38 ms 64 bytes from 220.181.111.188 (220.181.111.188):
操作截图:
修改后的效果见图:
[main] plugins=ifcfg-rh dns=none
# systemctl restart NetworkManager.service
nameserver 114.114.114.114 nameserver 8.8.8.8