栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Centos7网络重启失败

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Centos7网络重启失败

输入systemctl restart network.service后报错如下Job for network.service failed because the control process exited with error code.

[root@localhost network-scripts]# systemctl restart network.service
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

[root@localhost network-scripts]# 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 日 2022-05-29 20:39:26 CST; 11s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 11528 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
    Tasks: 1
   CGroup: /system.slice/network.service
           └─1052 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient-fa9aeba6-a0a5-4af8-8be5-9fb0e332d183-ens33.lease -pf /var/run/dhclient-ens33.pid ens33

5月 29 20:39:26 localhost.localdomain network[11528]: RTNETLINK answers: File exists
5月 29 20:39:26 localhost.localdomain network[11528]: RTNETLINK answers: File exists
5月 29 20:39:26 localhost.localdomain network[11528]: RTNETLINK answers: File exists
5月 29 20:39:26 localhost.localdomain network[11528]: RTNETLINK answers: File exists
5月 29 20:39:26 localhost.localdomain network[11528]: RTNETLINK answers: File exists
5月 29 20:39:26 localhost.localdomain network[11528]: RTNETLINK answers: File exists
5月 29 20:39:26 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
5月 29 20:39:26 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
5月 29 20:39:26 localhost.localdomain systemd[1]: Unit network.service entered failed state.
5月 29 20:39:26 localhost.localdomain systemd[1]: network.service failed.

查看日志文件cat /var/log/messages | grep network


解决方法:
1、修改网卡名称和配置文件

mv /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-eth0
vim /etc/sysconfig/network-scripts/ifcfg-eth0

按如下提示自行修改:

2、修改/etc/sysconfig/grub 添加net.ifnames=0 boisdevname=0

3、修改/etc/udev/rules.d/70-persistent-ipoib.rules文件
查看接口MAC地址
命令:ip link show或者ip addr

[root@localhost network-scripts]# ip link show
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens33:  mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 00:0c:29:13:79:ad brd ff:ff:ff:ff:ff:ff
3: virbr0:  mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:cb:1c:48 brd ff:ff:ff:ff:ff:ff
4: virbr0-nic:  mtu 1500 qdisc pfifo_fast master virbr0 state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:cb:1c:48 brd ff:ff:ff:ff:ff:ff

vim /etc/udev/rules.d/70-persistent-ipoib.rules

添加下图中标记内容:


reboot重启虚拟机就可以了
再次运行systemctl restart network.service没有报错

如果开启NetworkManager.service后再次报错

[root@localhost lj]# systemctl start NetworkManager.service
[root@localhost lj]# systemctl restart network.service
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

只需要关掉NetworkManager.service即可

[root@localhost lj]# service NetworkManager stop
Redirecting to /bin/systemctl stop NetworkManager.service
[root@localhost lj]# service network restart
Restarting network (via systemctl):                        [  确定  ]

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/941082.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号