Linux: VMware centos7

三种方法解决 Job for network.service failed. See 'systemctl status network.service' and 'journalctl -xn'问题

 

Failed to start LSB: Bring up/down networking 问题

 

1、执行 service network restart 出现以下错误

Restarting network (via systemctl):  Job for network.service failed. See 'systemctl status network.service' and 'journalctl -xn' for details.

2、根据上面的提示,执行“systemctl status network.service”输出以下的类似信息:

[root@localhost ~]# systemctl status network.service

network.service - LSB: Bring up/down networking

   Loaded: loaded (/etc/rc.d/init.d/network)

   Active: failed (Result: exit-code) since三 2014-11-05 15:30:10 CST; 1min 5s ago

 

11月 05 15:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists

11月 05 15:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists

11月 05 15:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists

11月 05 15:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists

11月 05 15:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists

11月 05 15:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists

11月 05 15:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists

11月 05 15:30:10 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1

11月 05 15:30:10 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.

11月 05 15:30:10 localhost.localdomain systemd[1]: Unit network.service entered failed state.

3、解决的办法(由于centos7中没有70-persistent-net.rules这个文件,复制出来的虚拟机(vmware)需要修改mac地址),就是修改mac地址。

 

4、如何查看centos7复制出来的虚拟机的mac地址,需要执行 “ip addr”,输出如下的类似信息:

[root@localhost ~]# ip addr

1: lo:

    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: eno16777736:

    link/ether 00:0f:19:10:12:f1 brd ff:ff:ff:ff:ff:ff

    inet 192.168.38.135/24 brd 192.168.38.255 scope global dynamic eno16777736

       valid_lft 1681sec preferred_lft 1681sec

    inet6 fe80::20c:11aa:ae11:4fe4/64 scope link

       valid_lft forever preferred_lft forever

 

注意上面加粗加红的字,这就是新的mac地址。

接下来就剩下修改ifcfg-XXX文件了,只修改HWADDR就可以了。接下来执行service network restart就正常了。

 

《二》

如果还是启动失败    查看是否有如下错误信息

Nov 23 22:09:07 hdcoe02 network[597]: Bringing up loopback interface:  Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'  

Nov 23 22:09:07 hdcoe02 network[597]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo' 

Nov 23 22:09:08 hdcoe02 network[597]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo' 

Nov 23 22:09:08 hdcoe02 network[597]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'  Nov 23 22:09:08 hdcoe02 network[597]: [  OK  ] 

Nov 23 22:09:08 hdcoe02 network[597]: Bringing up interface enp0s25:  Error: Connection activation failed: Connection 'enp0s25' is not available on the device enp0s25 at this time. 

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

systemctl enable NetworkManager-wait-online.service

《三》

我也是上面方法都测试完了 一直不成功,最后发现时因为在VMware 虚拟机里面的系统  右上角显示的连接都没有连接上,虽然报错都一样,最后我在虚拟机设置里面将原来的网络适配器删掉,重新建了一个新的网络适配器,这次进去,显示连接成功,再用上面的方法,问题解决。

 

要疯了!!!!今天又出现了这样的提示;但用了上面的方法还是没有效果,查看日志也是找不到蛛丝马迹,最后只能Google,

在一个博客上找到了我需要的答案,就是简单的关闭网络服务,然后再加载服务,然后再重启就好了,难道Centos的一个BUG??

  1.  
    [root@CT71 ~]# systemctl status network.service
  2.  
    ● network.service - LSB: Bring up/down networking
  3.  
    Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
  4.  
    Active: failed (Result: exit-code) since Fri 2017-08-04 08:20:31 CST; 1min 44s ago
  5.  
    Docs: man:systemd-sysv-generator(8)
  6.  
    Process: 62726 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)
  7.  
    Process: 63183 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
  8.  
     
  9.  
    Aug 04 08:20:31 CT71 network[63183]: RTNETLINK answers: File exists
  10.  
    Aug 04 08:20:31 CT71 network[63183]: RTNETLINK answers: File exists
  11.  
    Aug 04 08:20:31 CT71 network[63183]: RTNETLINK answers: File exists
  12.  
    Aug 04 08:20:31 CT71 network[63183]: RTNETLINK answers: File exists
  13.  
    Aug 04 08:20:31 CT71 network[63183]: RTNETLINK answers: File exists
  14.  
    Aug 04 08:20:31 CT71 network[63183]: RTNETLINK answers: File exists
  15.  
    Aug 04 08:20:31 CT71 systemd[1]: network.service: control process exited, code=exited status=1
  16.  
    Aug 04 08:20:31 CT71 systemd[1]: Failed to start LSB: Bring up/down networking.
  17.  
    Aug 04 08:20:31 CT71 systemd[1]: Unit network.service entered failed state.
  18.  
    Aug 04 08:20:31 CT71 systemd[1]: network.service failed.

如下:

systemctl stop NetworkManager

我在执行上面一步后就已经解决了问题,那个博客给出的答案还有下面的步骤,我没有用:

  1.  
    systemctl disable NetworkManager
  2.  
     
  3.  
    Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
  4.  
    Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
  5.  
    Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.

然后重启网络:

systemctl start network.service

可以使用了:

  1.  
    [root@123 bin]# ifconfig
  2.  
    ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
  3.  
    inet 192.168.10.128 netmask 255.255.0.0 broadcast 172.17.255.255
  4.  
    inet6 fe80::20c:29ff:fe84:b4 prefixlen 64 scopeid 0x20<link>
  5.  
    ether 00:0c:29:84:00:b4 txqueuelen 1000 (Ethernet)
  6.  
    RX packets 3629648 bytes 315562709 (300.9 MiB)
  7.  
    RX errors 0 dropped 0 overruns 0 frame 0
  8.  
    TX packets 2974 bytes 295864 (288.9 KiB)
  9.  
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  10.  
     
  11.  
    lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
  12.  
    inet 127.0.0.1 netmask 255.0.0.0
  13.  
    inet6 ::1 prefixlen 128 scopeid 0x10<host>
  14.  
    loop txqueuelen 1 (Local Loopback)
  15.  
    RX packets 90 bytes 6748 (6.5 KiB)
  16.  
    RX errors 0 dropped 0 overruns 0 frame 0
  17.  
    TX packets 90 bytes 6748 (6.5 KiB)
  18.  
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
 
posted @ 2020-11-22 16:25  灯下一个人  阅读(88)  评论(0编辑  收藏  举报