1.常用查看命令

[root@localhost ~]# nmcli device status[root@localhost ~]# nmcli connection show[root@localhost ~]# nmcli device connect ens32[root@localhost ~]# nmcli device disconnect ens32[root@localhost ~]# nmcli connection up ens32[root@localhost ~]# nmcli connection down ens32

2.使用nmcli配置网络

#创建名为new1的新连接[root@localhost ~]# nmcli connection add con-name new1 ifname ens32 type ethernet#配置new1的IP地址模式为静态及相应的IP[root@localhost ~]# nmcli connection modify new1 ipv4.method manual ipv4.addresses192.168.1.1/24 ipv4.gateway 192.168.1.254#设置连接自动启动[root@localhost ~]# nmcli connection modify new1 connection.autoconnect yes#设置为动态获取IP地址[root@localhost ~]# nmcli connection modify new1 ipv4.method auto#使配置文件生效(两者都可以)[root@localhost ~]# systemctl restart network[root@localhost ~]# nmcli connection reload

3.删除new1连接

[root@localhost ~]# nmcli connection delete new1