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

相关文章

#使用军哥的lnmp配置虚拟主机,需要注意的是要配置hosts文件(...
一、配置编译环境 yum update && yum upgra...
一、下载repo文件 二、备份并替换系统的repo文件 三、执行yu...
LAMP -- Linux Apache MySQL PHP 在CentOS安装的顺序,我一般...
一、下载nginx安装包,官网下载中心http://nginx.org/downlo...
1.下载composer curl -sS https://getcomposer.org/installe...