use*_*215 15 linux fedora linux-kernel network-interface
我已经克隆了一个 Fedora,现在正在尝试配置网络接口。每次我添加一个新的 NIC 时,它都以数字 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
~
Run Code Online (Sandbox Code Playgroud)
关于如何修复它的任何建议?
空/etc/udev/rules.d/70-persistent-net.rules:
[root@xxxsat601 ~]# echo > /etc/udev/rules.d/70-persistent-net.rules
[root@xxxsat601 ~]#
Run Code Online (Sandbox Code Playgroud)
并重新启动。它应该为您重新填充文件。该文件存在,因此如果您将新的 NIC 插入机器,使其看起来eth0不会采用您eth0的 IP 配置(如果您从配置中省略了 mac 地址),而是由一个新名称调用.
如果您截断文件,则无法将所有信息都保存在其中,除非硬件配置确实如此。
当您启动到克隆机器时,输入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。
重新启动虚拟机,您应该就可以开始了。这对我有用。