Categories

Tags

找不到eth0,但能找到eth1

环境是centos虚拟机

解决

udev记录网络规则的脚本为 /etc/udev/rules.d/70-persistent-net.rules

vi /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 0x1022:0x2000 (pcnet32)  
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:5a:6c:73", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"  
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a9:22:9d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

里面有eth0,eth1两个网卡的信息,但实际上你ifconfig时只能发现eth1一个网卡的信息,这是因为eth0根本就不存在。

将其中eth0的信息删掉,并将eth1信息中的NAME的值 eth1 改为eth0

最后重启系统即可

reboot