VM克隆后找不到eth0的问题解决

问题描述

使用VM WorkStation新建虚拟机A,查看IP信息,显示结果:

[root@centos65x64 ~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:0C:29:C7:E3:4C  
          inet addr:192.168.188.131  Bcast:192.168.188.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fec7:e34c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:120 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:11502 (11.2 KiB)  TX bytes:10035 (9.7 KiB)

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:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

此时,我们查看一下网卡信息:

[root@centos65x64 ~]# ll /etc/sysconfig/network-scripts/ifcfg-*
-rw-r--r--. 1 root root 137 Jan  9 16:55 /etc/sysconfig/network-scripts/ifcfg-eth0
-rw-r--r--. 1 root root 254 Oct 10  2013 /etc/sysconfig/network-scripts/ifcfg-lo
[root@centos65x64 ~]#

显然,查看IP信息时显示的网卡信息与实际的网卡信息时一致的,都是eth0。

接下来从虚拟机A克隆一台新的虚拟机B,查看其IP信息,显示结果:

[root@centos65_x64_Logstash ~]# ifconfig -a 
eth1      Link encap:Ethernet  HWaddr 00:0C:29:29:85:84  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.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:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@centos65_x64_Logstash ~]# 

再查看一下虚拟机B的网卡信息:

[root@centos65x64 ~]# ll /etc/sysconfig/network-scripts/ifcfg-*
-rw-r--r--. 1 root root 137 Jan  9 16:55 /etc/sysconfig/network-scripts/ifcfg-eth0
-rw-r--r--. 1 root root 254 Oct 10  2013 /etc/sysconfig/network-scripts/ifcfg-lo
[root@centos65x64 ~]#

那么问题来了,明明网卡名称是eth0,为什么在查看IP信息时显示的是eth1呢?而且还没有配置好正确的IP地址。
接着,我们再来看一下/etc/sysconfig/network-scripts/ifcfg-eth0中的配置信息:

[root@centos65x64 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:29:85:84
TYPE=Ethernet
UUID=eced92fe-8185-4081-a672-ac80e1d9fb95
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp

发现什么了吗?执行命令ifconfig -a显示的eth1的MAC地址与/etc/sysconfig/network-scripts/ifcfg-eth0中配置的MAC地址也不一样!

解决方案

第一步:编辑MAC地址,将/etc/sysconfig/network-scripts/ifcfg-eth0中配置的MAC地址修改为ifconfig -a显示的MAC地址。

[root@centos65x64 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:6E:2B:3C
TYPE=Ethernet
UUID=eced92fe-8185-4081-a672-ac80e1d9fb95
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp

第二步:修改网卡信息

[root@centos65x64 ~]# vim /etc/udev/rules.d/70-persistent-net.rules

  1 # This file was automatically generated by the /lib/udev/write_net_rules
  2 # program, run by the persistent-net-generator.rules rules file.
  3 #
  4 # You can modify it, as long as you keep each rule on a single
  5 # line, and change only the value of the NAME= key.
  6 
  7 # PCI device 0x8086:0x100f (e1000)
  8 #SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:6e:2b:3c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
  9 
 10 # PCI device 0x8086:0x100f (e1000)
 11 SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0C:29:29:85:84", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
 12 
 13 # PCI device 0x8086:0x100f (e1000)
 14 #SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:c7:e3:4c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

注释掉其最后一行名称为eth1的信息,同时将其中名称为eth0的网卡ATTR地址修改为ifconfig -a显示的MAC地址,重启。

【参考】
http://blog.csdn.net/cyuyan112233/article/details/6585680 vmware 下找不到ifcfg-eth0的问题

转载于:https://www.cnblogs.com/nuccch/p/8254153.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值