在一次把虚拟机暂停之后,睡眠了电脑,结果再一次唤醒电脑的时候,蓝屏了,重启之后发现CentOS无法连接网络了,经过多方查找,终于找到了解决办法。
首先使用如下命令查看一下具体的错误信息
systemctl status network.service
这次错误详情如下
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since 六 2019-01-12 23:59:22 CST; 12s ago
Docs: man:systemd-sysv-generator(8)
Process: 7872 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
1月 12 23:59:22 localhost.localdomain network[7872]: RTNETLINK answers: File exists
1月 12 23:59:22 localhost.localdomain network[7872]: RTNETLINK answers: File exists
1月 12 23:59:22 localhost.localdomain network[7872]: RTNETLINK answers: File exists
1月 12 23:59:22 localhost.localdomain network[7872]: RTNETLINK answers: File exists
1月 12 23:59:22 localhost.localdomain network[7872]: RTNETLINK answers: File exists
1月 12 23:59:22 localhost.localdomain network[7872]: RTNETLINK answers: File exists
1月 12 23:59:22 localhost.localdomain systemd[1]: network.service: control process...1
1月 12 23:59:22 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/do....
1月 12 23:59:22 localhost.localdomain systemd[1]: Unit network.service entered fai....
1月 12 23:59:22 localhost.localdomain systemd[1]: network.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
依次使用如下命令来解决问题
systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl start network.service
systemctl start NetworkManager
在查看一下网络状态,可以看到已经的开启了网络服务。
[root@localhost ~]# systemctl status network.service
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: active (running) since 日 2019-01-13 14:59:15 CST; 25min ago
Docs: man:systemd-sysv-generator(8)
Process: 8537 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)
Tasks: 1
CGroup: /system.slice/network.service
└─8794 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient-aa51532b-5804-...
1月 13 14:59:12 localhost.localdomain dhclient[8740]: bound to 192.168.148.131 -- ....
1月 13 14:59:12 localhost.localdomain network[8537]: 正在确定 ens33 的 IP 信息... …。
1月 13 14:59:15 localhost.localdomain network[8537]: [ 确定 ]
1月 13 14:59:15 localhost.localdomain systemd[1]: Started LSB: Bring up/down netwo....
1月 13 15:11:26 localhost.localdomain dhclient[8794]: DHCPREQUEST on ens33 to 192....)
1月 13 15:11:26 localhost.localdomain dhclient[8794]: DHCPACK from 192.168.148.254...)
1月 13 15:11:28 localhost.localdomain dhclient[8794]: bound to 192.168.148.131 -- ....
1月 13 15:23:10 localhost.localdomain dhclient[8794]: DHCPREQUEST on ens33 to 192....)
1月 13 15:23:10 localhost.localdomain dhclient[8794]: DHCPACK from 192.168.148.254...)
1月 13 15:23:12 localhost.localdomain dhclient[8794]: bound to 192.168.148.131 -- ....
Hint: Some lines were ellipsized, use -l to show in full.