阅读量:0
1、nmcli connection show 命令找到设备名称
# nmcli connection show NAME UUID TYPE DEVICE enp4s0 99559edf-4e0a-4bae-a528-6d75065261e9 ethernet enp4s0
2、nmcli connection modify 命令修改dns
nmcli connection modify enp4s0 ipv4.dns "114.114.114.114 8.8.8.8"
这时候查看/etc/sysconfig/network-scripts/ifcfg-enp4s0已修改了,但是/etc/resolv.conf还没修改
[root@localhost yum.repos.d]# cat /etc/sysconfig/network-scripts/ifcfg-enp4s0 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=no IPV6_AUTOCONF=no IPV6_DEFROUTE=no IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=enp4s0 UUID=99559edf-4e0a-4bae-a528-6d75065261e9 DEVICE=enp4s0 ONBOOT=yes IPADDR=10.100.1.99 PREFIX=24 GATEWAY=10.100.1.1 DNS1=114.114.114.114 DNS2=8.8.8.8
3、使用nmcli connection up命令生效
nmcli connection up enp4s0
成功执行后,/etc/resolv.conf也修改了