七叶笔记 » Linux » centos7系统重启网卡失败

centos7系统重启网卡失败

 

问题:

执行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. [失败]

(推荐教程:centos使用教程)

解决方法:

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

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

[root@royfans royfans]# ip a1: 
lo: <LOOPBACK,UP,LOWER_UP> 
mtu 65536 qdisc noqueue state UNKNOWN qlen 1link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope 
host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope
 hostvalid_lft forever preferred_lft forever2: ens33: 
<BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 
1000link/ether 00:0c:29:5f:9e:1d brd ff:ff:ff:ff:ff:ff3: virbr0:
 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
mtu 1500 qdisc noqueue state DOWN 
qlen 1000link/ether 52:54:00:67:8e:c3 brd ff:ff:ff:ff:ff:ffinet 
192.168.122.1/24 brd 192.168.122.255 scope global virbr0valid_lft 
forever preferred_lft forever4: virbr0-nic: 
<BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state
 DOWN qlen 1000link/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改为和文件名一致。

相关视频教程分享:linux视频教程

相关文章