1.常用查看命令
[root@localhost~]#nmclidevicestatus [root@localhost~]#nmcliconnectionshow [root@localhost~]#nmclideviceconnectens32 [root@localhost~]#nmclidevicedisconnectens32 [root@localhost~]#nmcliconnectionupens32 [root@localhost~]#nmcliconnectiondownens32
2.使用nmcli配置网络
#创建名为new1的新连接 [root@localhost~]#nmcliconnectionaddcon-namenew1ifnameens32typeethernet #配置new1的IP地址模式为静态及相应的IP [root@localhost~]#nmcliconnectionmodifynew1ipv4.methodmanualipv4.addresses192.168.1.1/24ipv4.gateway192.168.1.254 #设置连接自动启动 [root@localhost~]#nmcliconnectionmodifynew1connection.autoconnectyes #设置为动态获取IP地址 [root@localhost~]#nmcliconnectionmodifynew1ipv4.methodauto #使配置文件生效(两者都可以) [root@localhost~]#systemctlrestartnetwork [root@localhost~]#nmcliconnectionreload
3.删除new1连接
[root@localhost~]#nmcliconnectiondeletenew1