RHEL七、CentOS7默認安裝以後是沒有啓動網絡鏈接!(咱們就不按6的方試設置IP了,用命令方試添加IP、網關和DNS)html
1、設置IP地址、網關和DNS網絡
#nmcli connection add type ethernet autoconnect yes con-name eht0 ifname eth0 ip4 192.168.99.2 gw4 192.168.99.1 #添加IP地址和網站 #nmcli connection modify eth0 ipv4.dns 8.8.8.8 #添加DNS #systemctl restart network #從新啓動網絡
#ip a #查看IPoop
[root@www ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 18:66:da:eb:15:cc brd ff:ff:ff:ff:ff:ff inet 192.168.99.2/24 brd 192.168.99.255 scope global eth0 valid_lft forever preferred_lft forever
#ping -c4 www.baidu.com網站
2、修改IP地址、網關和DNSspa
# nmcli connection modify eth0 ipv4.addresses 192.168.0.11/24 # nmcli connection modify eth0 ipv4.method manual #nmcli connection modify eth0 ipv4.dns 9.9.9.9 #systemctl restart network
#ip a 也可經過 #nmcli show devrest
[root@www ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 18:66:da:eb:15:cc brd ff:ff:ff:ff:ff:ff inet 192.168.0.11/24 brd 192.168.0.255 scope global eth0 valid_lft forever preferred_lft forever
#man nmcli 能夠經過查看網卡幫助文件有更詳細的說明htm
至此:RHEL七、CentOS7添加網卡和修改網卡IP、DNS 已完成blog