![设备eth0似乎不存在,延迟初始化](https://linux22.com/image/63395/%E8%AE%BE%E5%A4%87eth0%E4%BC%BC%E4%B9%8E%E4%B8%8D%E5%AD%98%E5%9C%A8%EF%BC%8C%E5%BB%B6%E8%BF%9F%E5%88%9D%E5%A7%8B%E5%8C%96.png)
我已经克隆了一个 Fedora,现在尝试配置网络接口。每次我添加新的网卡时,它都会以编号 eth3(而不是 eth0)开头。我尝试删除和修改70-persistent-net.rules
以及 ,network-scripts/eth0
但似乎没有任何方法可以解决问题。这是我的机器的一些输出
[root@abc ~]# ls /sys/class/net
eth3 eth4 lo pan0
[root@abc ~]# cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.
# PCI device 0x15ad:0x07b0 (vmxnet3)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:29:7f:eb", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x15ad:0x07b0 (vmxnet3)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:29:7f:ff", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
# PCI device 0x15ad:0x07b0 (vmxnet3)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:29:7f:f5", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a3:3e:16", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a3:3e:20", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a3:3e:2a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
[root@abc ~]# service network restart
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization.
[FAILED]
[root@abc ~]#
[root@abc network-scripts]# vi ifcfg-eth0
# Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
HWADDR=00:0c:29:a3:3e:16
IPADDR=192.168.1.75
IPV6INIT=yes
IPV6_AUTOCONF=yes
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
NM_CONTROLLED=no
GATEWAY=192.168.1.1
~
关于如何修复它有什么建议吗?
答案1
空的/etc/udev/rules.d/70-persistent-net.rules
:
[root@xxxsat601 ~]# echo > /etc/udev/rules.d/70-persistent-net.rules
[root@xxxsat601 ~]#
并重新启动。它应该为您重新填充该文件。该文件存在的目的是,如果您将新的 NIC 插入计算机,则它eth0
不会采用您的eth0
IP 配置(如果您在配置中省略了 mac 地址),而是通过新名称进行调用。
如果您截断该文件,则所有信息都无法保存在其中,除非硬件配置确实如此。
答案2
当您启动克隆机器时,输入ifconfig -a
您将看到没有 eth0,但应该有 eth1。由于该文件,它正在尝试启动 eth0 /etc/sysconfig/network-scripts/ifcfg-eth0
。
要解决此问题,请编辑/etc/udev/rules.d/70-persistent-net.rules
.删除 eth0 的第一个块。将第二个块更改为NAME="eth0"
复制 MAC 并替换 MAC /etc/sysconfig/network-scripts/ifcfg-eth0
,并根据需要编辑 IP。
重新启动虚拟机,您应该就可以开始了。这对我有用。