今天在centOS 7 network服务重启不了

现把各种解决方法归纳整理,希望能让后面的同学少走点歪路。。。

首先看问题:执行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 五 2017-07-14 19:01:47 CST; 1min 16s ago
Docs: man:systemd-sysv-generator(8)
Process: 4681 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
CGroup: /system.slice/network.service
└─1192 /sbin/dhclient -H mini1 -1 -q -lf /var/lib/dhclient/dhclient--ens33.lease -pf /v...
7月 14 19:01:47 mini1 network[4681]: RTNETLINK answers: File exists
7月 14 19:01:47 mini1 network[4681]: RTNETLINK answers: File exists
7月 14 19:01:47 mini1 network[4681]: RTNETLINK answers: File exists
7月 14 19:01:47 mini1 network[4681]: RTNETLINK answers: File exists
7月 14 19:01:47 mini1 network[4681]: RTNETLINK answers: File exists
7月 14 19:01:47 mini1 network[4681]: RTNETLINK answers: File exists
7月 14 19:01:47 mini1 systemd[1]: network.service: control process exited, code=exited status=1
7月 14 19:01:47 mini1 systemd[1]: Failed to start LSB: Bring up/down networking.
7月 14 19:01:47 mini1 systemd[1]: Unit network.service entered failed state.
7月 14 19:01:47 mini1 systemd[1]: network.service failed.
network服务启动不了首先保证/etc/sysconfig/network-scripts目录下的ifcfg-xxx(每台机器不一定相同)没有错误(如果你改动过的话),这里的错误指的在更改过程中因为手误敲错字母之类的。
网上最常见的几种做法如下:

1.和 NetworkManager 服务有冲突,这个好解决,直接关闭 NetworkManger 服务就好了, service NetworkManager stop,并且禁止开机启动 chkconfig NetworkManager off 。之后重启就好了。

2和配置文件的MAC地址不匹配,这个也好解决,使用ip addr(或ifconfig)查看mac地址

[root@royfans royfans]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 00:0c:29:5f:9e:1d brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
link/ether 52:54:00:67:8e:c3 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
link/ether 52:54:00:67:8e:c3 brd ff:ff:ff:ff:ff:ff

00:0c:29:5f:9e:1d这个就是MAC地址了,将/etc/sysconfig/network-scripts/ifcfg-xxx中的HWADDR(如果没有就添加上)改成这个MAC地址

3.设定开机启动一个名为NetworkManager-wait-online服务,命令为:
systemctl enable NetworkManager-wait-online.service

=========================================================================================================

上面两个是我看到最多的解决方法,但是很遗憾,我的并没有解决。

有查看资料,发现了以下一些方法:

4.查看/etc/sysconfig/network-scripts下,将其余无关的网卡位置文件全删掉,避免不必要的影响,即只留一个以ifcfg开头的文件,

5.将ifcfg-xxx文件中的DEVICE一行注释掉。

6.将ifcfg-xxx中的NAME改为和文件名一致。

05-25 16:01