CentOS 7网卡配置-nmcli

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

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native