device和connection是分开的
插上新网卡后, 有device 没有connection;
ip地址在connection上
#设置为静态ip
nmcli connection modify eth1 ipv4.method manual ipv4.address 192.168.0.3/24 ipv4.gateway 192.168.0.1 ipv4.dns 114.114.114.114
nmcli device up eth1
nmcli connection up eth1
如果connection名字是Wired Connection 1, 想改名字:
nmcli connection edit "Wired Connection 1"
#进入交互式环境
help
print all
#connection.id Wired Connection 1
#因此改名字命令如下
set connection.id eth1
save
quit