Linux网卡启动报错Job for network.service failed处理方法

[复制链接] |主动推送
查看68 | 回复0 | 2024-9-10 23:58:04 | 显示全部楼层 |阅读模式
在运行“/etc/init.d/network restart”命令时,出现错误“Job for network.service failed. See 'systemctl status network.service' and 'journalctl -xn' for deta”,运行“cat /var/log/messages | grep network”命令查看日志中出现的与network相关的信息,会发现下面输出语句:
Nov 17 11:31:16 openstack network: Bringing up interface eth0:  Error: no device found for connection 'eth0'.
Nov 17 11:31:16 openstack network: [FAILED]
Nov 17 11:31:16 openstack network: RTNETLINK answers: File exists
Nov 17 11:31:16 openstack network: RTNETLINK answers: File exists
Nov 17 11:31:16 openstack network: RTNETLINK answers: File exists
Nov 17 11:31:16 openstack network: RTNETLINK answers: File exists
Nov 17 11:31:16 openstack network: RTNETLINK answers: File exists
Nov 17 11:31:16 openstack network: RTNETLINK answers: File exists
Nov 17 11:31:16 openstack network: RTNETLINK answers: File exists
Nov 17 11:31:16 openstack network: RTNETLINK answers: File exists
Nov 17 11:31:16 openstack network: RTNETLINK answers: File exists
Nov 17 11:31:16 openstack systemd: network.service: control process exited, code=exited status=1
Nov 17 11:31:16 openstack systemd: Failed to start LSB: Bring up/down networking.
Nov 17 11:31:16 openstack systemd: Unit network.service entered failed state.

从错误提示“Error: no device found for connection 'eth0'”可以确定是配置文件eth0的问题,打开查看/etc/sysconfig/network-scripts/ifcfg-eth0文件发现其中的MAC地址和ifconfig命令输出的MAC地址不一样,具体如下所示:
[root@openstack ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
HWADDR=1A:E9:47:A5:75:C8
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPADDR=192.168.1.79
PREFIX=24
GATEWAY=192.168.1.1
DNS1=192.168.1.1
DNS2=8.8.8.8
NAME=eth0
UUID=ba670f0c-201a-483b-8379-c8c72c03ab27
ONBOOT=yes

[root@openstack ~]# ifconfig
eth0: flags=4163  mtu 1500
        inet 192.168.1.79  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::8081:a6ff:fe9d:5887  prefixlen 64  scopeid 0x20
        ether 82:81:a6:9d:58:87  txqueuelen 1000  (Ethernet)
        RX packets 3426  bytes 394042 (384.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 57  bytes 9578 (9.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

所以只需将ifcfg-eth0中的HWADDR变量值改为ifconfig命令里显示的MAC地址即可。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则