虚拟机CentOS 7克隆后使用ifconfig
命令查看没有ip地址。
然后使用service network restart
命令报错如下:
Restarting network (via systemctl): Job for network.service failed because the control process exited with error code.
See "systemctl status network.service" and "journalctl -xe" for details.
接着使用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 Mon 2019-12-30 19:25:39 CST; 31s ago
Docs: man:systemd-sysv-generator(8)
Process: 4198 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
Dec 30 19:25:39 localhost.localdomain network[4198]: RTNETLINK answers: File ...
Dec 30 19:25:39 localhost.localdomain network[4198]: RTNETLINK answers: File ...
Dec 30 19:25:39 localhost.localdomain network[4198]: RTNETLINK answers: File ...
Dec 30 19:25:39 localhost.localdomain network[4198]: RTNETLINK answers: File ...
Dec 30 19:25:39 localhost.localdomain network[4198]: RTNETLINK answers: File ...
Dec 30 19:25:39 localhost.localdomain network[4198]: RTNETLINK answers: File ...
Dec 30 19:25:39 localhost.localdomain systemd[1]: network.service: control pr...
Dec 30 19:25:39 localhost.localdomain systemd[1]: Failed to start LSB: Bring ...
Dec 30 19:25:39 localhost.localdomain systemd[1]: Unit network.service entere...
Dec 30 19:25:39 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