Centos7修改DNS
作者:
猪猪学上树 | 来源:发表于
2019-08-01 14:06 被阅读0次
- 显示当前网络连接
nmcli connection show
- 修改当前网络连接对应的DNS服务器,这里的网络连接可以用名称或者UUID来标识,二个NDS根据需求修改,一般添加这二个就可以。
nmcli con mod ens160 ipv4.dns "114.114.114.114 8.8.8.8"
- 将dns配置生效
nmcli con up ens160
[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): icmp_seq=5 ttl=52 time=2.58 ms
本文标题:Centos7修改DNS
本文链接:https://www.haomeiwen.com/subject/lhvqdctx.html
网友评论