拷贝的Linux虚拟机“Device eth0 does not seem to be present, delaying initialization”问题解决方法...

错误: 在Vmware/virtualbox上新建一个拷贝的Red Hat Enterprise Linux虚拟机,启动时发现找不到网卡(上不去网):


[root[@primary](https://my.oschina.net/primary) ~]# service network restart
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                               [  OK  ]
Bringing up interface eth0:  Device eth1 does not seem to be present, delaying initialization.
                                                                                [FAILED]

错误原因: 克隆的Linux系统在新的机器上运行,新服务器网卡物理地址已经改变。而/etc/udev/rules.d/70-persistent-net.rules这个文件确定了网卡和MAC地址的信息之间的绑定,克隆后的网卡的MAC已经发生了变化,所以导致系统认为网络设备不存在,网络不能正常启动。另外一个就是/etc/sysconfig/network-scripts/ifcfg-eth0里面MAC地址也是以前的旧信息。 关于/etc/udev/rules.d/70-persistent-net.rules这个文件,系统在启动时会自动监测变化,然后由/lib/udev/write_net_rules写入到/etc/udev/rules.d/70-persistent-net.rules中一个新的配置节,网卡的的序号依次递增(如原来为eth0,则修改第一后生成一个eth1,再次修改后生成一个eth2...),且其ATTR{address}的值为当前网卡对应的mac地址。

[root[@primary](https://my.oschina.net/primary) ~]# 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, and change only the value of the NAME= key.

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:2a:c4:f0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

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

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:8e:51:f6", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
"/etc/udev/rules.d/70-persistent-net.rules" 14L, 750C

[root@primary ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 看到里面配置的的确是eth1的旧信息,实际是需要配置为最新的eth2的信息。

解决方法: 1.编辑/etc/sysconfig/network-scripts/ifcfg-eth0配置文件,修改为eth2的配置信息并设置为静态:DEVICE=eth2, BOOTPROTO=static, HWADDR=08:00:27:8e:51:f6 2.重启网卡服务成功即可。

[root[@primary](https://my.oschina.net/primary) ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth2
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
DNS1=114.114.114.114
IPADDR=192.168.100.238
NETMASK=255.255.255.0
GATEWAY=192.168.100.254
PREFIX=24
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth2"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
HWADDR=08:00:27:8e:51:f6
LAST_CONNECT=1464664485
USERCTL=no
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
"/etc/sysconfig/network-scripts/ifcfg-eth0" 18L, 341C
[root[@primary](https://my.oschina.net/primary) ~]# service network restart (或者/etc/init.d/network restart)
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                               [  OK  ]
Bringing up interface eth0:  Determining if ip address 192.168.100.238 is already in use for device eth2...
                                                                                 [  OK  ]

[root[@primary](https://my.oschina.net/primary) ~]# ifconfig
eth2      Link encap:Ethernet  HWaddr 08:00:27:8E:51:F6  
          inet addr:192.168.100.238  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe8e:51f6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3378 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:234683 (229.1 KiB)  TX bytes:776 (776.0 b)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:901 (901.0 b)  TX bytes:901 (901.0 b)

转载于:https://my.oschina.net/liuyuanyuangogo/blog/779043

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值