service network restart 执行时报错

环境:centos7

异常:

执行 service network restart 时报错

按提示键入“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 Thu 2020-03-19 14:03:10 CST; 6s ago
Docs:man:systemd-sysv-generator(8)
Process:19261 ExecStart=/etc/rc.d/init.d/network start(Code=exited, status=1/FAILURE)

network[19261]: RTNETLINK answers:File exists
systemd[1]: network.service: control process exited, code=exited status=1
systemd[1]: Failed to start LSB: Bring up/down networking.
systemd[1]: Unit network.service entered failed state.
systemd[1]: network.service failed.

 

解决方法:

1、执行 ip addr flush dev eth0  

因机器而异,此处执行的是 ip addr flush dev enp0s31f6

可查看 /etc/sysconfig/network-scripts/ 下的 ifcfg-xxx 文件,xxx 即上述命名中的变量

2、关闭网络管理器

systemctl stop NetworkManager

systemctl disable NetworkManager

3|、然后就可以重启网络了

systemctl start network.service

service network restart

你可能感兴趣的:(centos7)