VMWare克隆linux系统之后,网卡问题

当linux系统在识别网卡的时候会把mac地址和网卡名称对应起来记录到udev的脚本中,但是VMWare会给我们自动生成虚拟机的mac地址,但是在我们克隆的linux系统中udev脚本中已经记录了原本的mac地址与网卡名称,也就是eth0,但现在克隆过的虚拟机的mac地址已经不再是之前的mac地址了,所以udev就会自动将这个网卡的mac地址对应上网卡eth1(udev会记录所有已经识别的mac地址和网卡的对应关系,网卡名都会+1)kenerl仅仅只识别到了一张网卡,跟网卡名相关的网络配置也就没有发生变化。

 

解决办法:

1,文件:/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:50:56:bc:00:45", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"  
  9.   
  10. # PCI device 0x8086:0x100f (e10000)  
  11. SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:46", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"  
# 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:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:45", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e10000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:46", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

 

将eth0网卡的代码注释掉,然后将eth1改成eth0

 

  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:50:56:bc:00:45", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"  
  9.   
  10. # PCI device 0x8086:0x100f (e10000)  
  11. SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:46", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"  
# 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:0x100f (e1000)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:45", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e10000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:46", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


2,修改:   /etc/sysconfig/network-scripts/ifcfg-eth0

 

把mac地址改为新的mac地址,即

HWADDR=00:50:56:bc:00:46

 

#啰嗦一下 : 更改host名称

编辑 /etc/sysconfig/network

  1. # vi /etc/sysconfig/network  
# vi /etc/sysconfig/network
  1. NETWORKING=yes  
  2. HOSTNAME= myhostname  
NETWORKING=yes
HOSTNAME= myhostname

 

 

3,reboot系统

posted @ 2016-06-14 17:10  亦非台  阅读(167)  评论(0编辑  收藏  举报