centos MAC 地址与报错eth0 unknown interface no such device

来源:互联网 发布:linux父目录和子目录 编辑:程序博客网 时间:2024/05/22 01:56

eth0 unknown interface no such device

出现这个原因是由于虚拟机直接COPY过来,MAC地址发生了变化,但eth0 里仍然记录着旧的MAC地址。

解决方法:

vim  /etc/udev/rules.d/70-persistent-net.rules 

# PCI device 0x8086:0x100e (e1000) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:25:d3:1c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:37:20:1e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"


  eth1记录着新MAC地址,eth0是旧的地址。

操作步骤:

1.

将eth0的ATTR{address}==eht1的MAC地址

2. 

删除eth1 的配置,也就以下内容删除:

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:37:20:1e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

3. 

vim /etc/sysconfig/network-scripts/ifcfg-eth0
将MAC地址改为:

HWADDR=08:00:27:25:d3:1c  #必须对应etho是的MAC地址(/etc/udev/rules.d/70-persistent-net.rules)


0 0
原创粉丝点击