解决报错Failed to start LSB: Bring up/down networking:MAC地址导致
1.场景描述,我在电脑里装好的虚拟机,今天突然就网络无法打开,并出现如下报错:
[root@ansible-control ~]# systemctl start network
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
[root@ansible-control ~]# systemctl status network
● 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-09-29 22:44:34 CST; 1s ago
Docs: man:systemd-sysv-generator(8)
Process: 5042 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
9月 29 22:44:34 ansible-control network[5042]: RTNETLINK answers: File exists
9月 29 22:44:34 ansible-control network[5042]: RTNETLINK answers: File exists
9月 29 22:44:34 ansible-control network[5042]: RTNETLINK answers: File exists
9月 29 22:44:34 ansible-control network[5042]: RTNETLINK answers: File exists
9月 29 22:44:34 ansible-control network[5042]: RTNETLINK answers: File exists
9月 29 22:44:34 ansible-control network[5042]: RTNETLINK answers: File exists
9月 29 22:44:34 ansible-control systemd[1]: network.service: control process exited, code=exited...s=1
9月 29 22:44:34 ansible-control systemd[1]: Failed to start LSB: Bring up/down networking.
9月 29 22:44:34 ansible-control systemd[1]: Unit network.service entered failed state.
9月 29 22:44:34 ansible-control systemd[1]: network.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
2.解决方法
关闭NetworkManager,罪魁祸首就是这个服务!
第一步:查看NetworkManager服务状态:
第二步:关闭NetworkManager,并设置开启默认不启动该服务:
[root@ansible-control ~]# systemctl stop NetworkManager [root@ansible-control ~]# systemctl disable NetworkManager Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service. Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service. Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
第三步:重启network服务
[root@ansible-control ~]# 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-09-29 22:53:32 CST; 9s ago Docs: man:systemd-sysv-generator(8) Process: 3620 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
发现还是报错,此时,我又百度了其它方法尝试,发现是MAC地址的问题,参考一篇文章:https://www.raksmart.com/29.html?l=zh-cn
第四步:查询主机的硬件地址:
第五步:修改/etc/sysconfig/network-scripts/ifcfg-配置_1文件
第六步:再次重启网络
[root@ansible-control ~]# systemctl restart network [root@ansible-control ~]# systemctl status network
此时已经成功开启网络!