Linux 重启network 失败的解决办法

栏目: 服务器 · 发布时间: 6年前

内容简介:执行看红色部门

执行 systemctl restart network 失败

[root@ceph0 ~]# systemctl restart 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@ceph0 ~]# 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-03-26 12:02:46 CST; 8s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3185106 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

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

看红色部门 Failed to start LSB: Bring up/down networking. 但是实际上这个信息并没有什么卵用

Linux 重启network 失败的解决办法

要是你拿着这个信息不假思索的去网上搜一圈,我相信你有可能失望而归。CSDN 等博客都是你抄我,我抄你,从来都不验证下的,就是复制粘贴。

排查思路

遇到这种问题,最好的办法就是看日志输出了啥咯,执行 tail -f /var/log/messages|grep network

[root@ceph0 ~]# tail -f /var/log/messages|grep network
Mar 26 12:05:06 ceph0 systemd: Starting LSB: Bring up/down networking...
Mar 26 12:05:06 ceph0 network: Bringing up loopback interface:  [  OK  ]
Mar 26 12:05:06 ceph0 network: Bringing up interface eth0:  [  OK  ]
Mar 26 12:05:06 ceph0 network: Bringing up interface eth1:  Error: Connection activation failed: No suitable device found for this connection.
Mar 26 12:05:06 ceph0 network: [FAILED]
Mar 26 12:05:06 ceph0 network: Bringing up interface eth2:  Error: Connection activation failed: No suitable device found for this connection.
Mar 26 12:05:06 ceph0 network: [FAILED]
Mar 26 12:05:06 ceph0 network: RTNETLINK answers: File exists
Mar 26 12:05:06 ceph0 network: RTNETLINK answers: File exists
Mar 26 12:05:06 ceph0 network: RTNETLINK answers: File exists
Mar 26 12:05:06 ceph0 network: RTNETLINK answers: File exists
Mar 26 12:05:06 ceph0 network: RTNETLINK answers: File exists
Mar 26 12:05:06 ceph0 network: RTNETLINK answers: File exists
Mar 26 12:05:06 ceph0 network: RTNETLINK answers: File exists
Mar 26 12:05:06 ceph0 network: RTNETLINK answers: File exists
Mar 26 12:05:06 ceph0 network: RTNETLINK answers: File exists
Mar 26 12:05:06 ceph0 systemd: network.service: control process exited, code=exited status=1
Mar 26 12:05:06 ceph0 systemd: Failed to start LSB: Bring up/down networking.
Mar 26 12:05:06 ceph0 systemd: Unit network.service entered failed state.
Mar 26 12:05:06 ceph0 systemd: network.service failed.

可以看到报错

Mar 26 12:05:06 ceph0 network: Bringing up interface eth1:  Error: Connection activation failed: No suitable device found for this connection.
Mar 26 12:05:06 ceph0 network: [FAILED]
Mar 26 12:05:06 ceph0 network: Bringing up interface eth2:  Error: Connection activation failed: No suitable device found for this connection.

很明显,没有eth1 和eth2 接口 导致报错,进入 /etc/sysconfig/network-scripts/

[root@ceph0 ~]# cd /etc/sysconfig/network-scripts/
[root@ceph0 network-scripts]# ls
ifcfg-eth0   ifdown-eth   ifdown-post      ifdown-tunnel  ifup-ippp   ifup-post      ifup-tunnel
ifcfg-eth1   ifdown-ib    ifdown-ppp       ifup           ifup-ipv6   ifup-ppp       ifup-wireless
ifcfg-eth2   ifdown-ippp  ifdown-routes    ifup-aliases   ifup-isdn   ifup-routes    init.ipv6-global
ifcfg-lo     ifdown-ipv6  ifdown-sit       ifup-bnep      ifup-ovs    ifup-sit       network-functions
ifdown       ifdown-isdn  ifdown-Team      ifup-eth       ifup-plip   ifup-Team      network-functions-ipv6
ifdown-bnep  ifdown-ovs   ifdown-TeamPort  ifup-ib        ifup-plusb  ifup-TeamPort
[root@ceph0 network-scripts]#

删除eth1 和eth2 配置文件,重启网卡即可

root@ceph0 network-scripts]# rm -rf ifcfg-eth1 ifcfg-eth2
[root@ceph0 network-scripts]# systemctl restart network
[root@ceph0 network-scripts]#

Linux 重启network 失败的解决办法


以上所述就是小编给大家介绍的《Linux 重启network 失败的解决办法》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

部落:一呼百应的力量

部落:一呼百应的力量

高汀 (Godin.S.) / 刘晖 / 中信出版社 / 2009-7 / 26.00元

部落指的是任何一群人,规模可大可小,他们因追随领导、志同道合而相互联系在一起。人类其实数百万年前就有部落的出现,随之还形成了宗教、种族、政治或甚至音乐。 互联网消除了地理隔离,降低了沟通成本并缩短了时间。博客和社交网站都有益于现有的部落扩张,并促进了网络部落的诞生——这些部落的人数从10个到1000万个不等,他们所关注的也许是iPhone,或一场政治运动,或阻止全球变暖的新方法。 那么......一起来看看 《部落:一呼百应的力量》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器