1.网卡查看
nmcli c = nmcli connection show
nmcli c s = nmcli connection show eth0 #查看网卡信息
显示所有设备配置状态
2.网卡配置
nmcli掩码和IP写到一起了
- 255.0.0.0/8
- 255.255.0.0/16
- 255.255.255.0/24
nmcli connection modify eth0 ipv4.method manual
nmcli connection modify eth0 ipv4.addresses 192.168.0.58/24 ipv4.gateway 192.168.0.2 ipv4.dns 114.114.114.114
删除DNS
# nmcli connection modify eth0 -ipv4.dns 114.114.114.114
添加一个网卡
nmcli connection add type ethernet con-name eth0 ifname eno123
添加一个ipv4
# nmcli connection modify eth0 +ipv4.addresses 192.168.10.159/24
3.网卡重启
nmcli connection up eth0 打开网卡
nmcli connection down eth0 关闭网卡
# 配置完后使用如下任意两条命令执行加载配置 更新网卡的操作
[root@rhel8 ~]# nmcli device connect eth0
Device 'eth0' successfully activated with '6ee6c69c-7753-4ef0-8f95-5be18adc75db'.
[root@rhel8 ~]# nmcli device reapply eth0
Connection successfully reapplied to device 'eth0'.