首先尝试
ifconfig
得到:
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:0c:29:75:d9:f6 txqueuelen 1000 (Ethernet)
RX packets 15 bytes 1488 (1.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
好多0,运行:
sudo ifup ens33
得到:
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
这样就ok了,可以试一下:
ping www.baidu.com
写入配置文件
但是每次重启都会遇到这个问题,因此为了永久解决,需要修改一个地方:
sudo vi /etc/sysconfig/network-scripts/ifcfg-ens33
把最后一行改为yes
:
ONBOOT=yes