当前第2页 返回上一页
6 修改连接设置
(1)修改test2为自动启动
1 | [root@centos73 ~]# nmcli connection modify test2 connection.autoconnect yes
|
(2)修改DNS为172.25.1.1
1 | [root@centos73 ~]# nmcli connection modify test2 ipv4.dns 172.25.1.1
|
(3)添加DNS 114.114.114.114
1 | [root@centos73 ~]# nmcli connection modify test2 +ipv4.dns 114.114.114.114
|
看下是否成功
1 2 3 4 5 6 7 8 9 10 11 12 13 | [root@centos73 ~]# cat /etc/sysconfig/network-scripts/ifcfg-test2
TYPE=Ethernet
[……]
NAME=test2
UUID=98385bf5-8cc3-47e3-a5f2-51e2d736be6d
DEVICE=ens33
ONBOOT=yes
DNS1=172.25.1.1
IPADDR=172.25.100.100
PREFIX=24
GATEWAY=172.25.100.1
DNS2=114.114.114.114
|
可以看到均已生效
(4)删除DNS
1 | [root@centos73 ~]# nmcli connection modify test2 -ipv4.dns 114.114.114.114
|
(5)修改IP地址
1 | [root@centos73 ~]# nmcli connection modify test2 ipv4.addresses 200.100.100.100/24 gw4 200.100.100.1
|
(6)还可以添加多个IP
1 | [root@centos73 ~]# nmcli connection modify test2 +ipv4.addresses 10.10.10.10/8
|
7 nmcli 命令和/etc/sysconfig/network-scripts/ifcfg-*文件的对应关系
ipv4.method manual BOOTPROTO=none
ipv4.method auto BOOTPROTO=dhcp
ipv4.addresses "192.0.2.1/24 IPADDR=192.0.2.1
PREFIX=24
gw4 192.0.2.254" GATEWAY=192.0.2.254
ipv4.dns 8.8.8.8 DNS0=8.8.8.8
ipv4.dns-search example.com DOMAIN=example.com
ipv4.ignore-auto-dns true PEERDNS=no
connection.autoconnect yes ONBOOT=yes
connection.id eth0 NAME=eth0
connection.interface-name eth0 DEVICE=eth0
802-3-ethernet.mac-address . . . HWADDR= . . .
以上就是nmcli的网络配置的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
centos下不能ping通网络怎么解决
centos7系统网络不稳定怎么办
详解网络的五层协议
linux系统怎么ping网络
nmcli的网络配置
centos系统网络不通怎么办
centos系统连接网络不可达怎么办
centos7下网络ping不通
linux系统升级后网络不稳定的解决方法
centos7连不上网络
更多相关阅读请进入《nmcli》频道 >>
转载请注明出处:木庄网络博客 » nmcli的网络配置