首页 > 代码库 > 网卡eth0 未识别的端口

网卡eth0 未识别的端口

CentOS 虚拟机

设置完ip地址,重启网络服务报错:

# service network restart

Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Error: No suitable device found: no device found for connection ‘System eth0‘.       [FAILED]

解决方法:

# vi /etc/udev/rules.d/70-persistent-net.rules  #网络在启动的时候会去读取该配置文件 /etc/udev/rules.d/70-persistent-net.rules 信息

查看文件信息发现有两个网卡,eth0和eth1:

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:fd:8b:ad", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:57:13:79", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

查看本机的ip配置文件,发现只有一个eth0:

若想设置eth0则可以把上面70-persistent-net.rules文件中的eth1的mac地址复制给eth0,并注释掉eth1,并更新到ifcfg-eth0中的mac地址:

70-persistent-net.rules:

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:57:13:79", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:57:13:79", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
-------------------------------------

ifcfg-eth0:

重启网络服务,网卡正常:

# service network restart

该虚拟机为克隆出来的,可能就导致网卡1的mac地址不能用了。

网卡eth0 未识别的端口