默認安裝centos7的時候,選擇最小安裝,這時候默認沒有啓用網絡的,系統開機後沒法使用網絡centos
1.查看物理網卡的地址:網絡
ifconfig 或者 ip addr均可以的oop
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.80.136 netmask 255.255.255.0 broadcast 192.168.80.255
inet6 fe80::c89b:1871:b2c6:3a60 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:0e:a8:cb txqueuelen 1000 (Ethernet)
RX packets 1778 bytes 116068 (113.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 175 bytes 23426 (22.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0centos7
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 268 bytes 23300 (22.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 268 bytes 23300 (22.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0spa
2.能夠看到ens33爲物理網卡,這時候,能夠用如下方式去開啓網絡鏈接3d
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# ll
總用量 232
-rw-r--r--. 1 root root 310 4月 11 2019 ifcfg-ens33rest
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33blog
改爲:onboot=yesip
接ESC 退出 :wq 保存io
3.重啓網絡服務:
[root@localhost network-scripts]# systemctl restart network.service
4.重啓後:ping www.baidu.com
解析正常了,網絡啓用正常