centos6更換網卡之後,網卡名稱都是自增。例如原來是eth0,更換後變成識別eth1,不能使用原來的eth0了,需要修改一下檔案:
當網卡變動時.當新加網卡時.或換網卡時.這個檔案都會有變化.對應的修改mac 或eth *這個名字.來調整.
1、Vi /etc/udev/rules.d/70-persistent-net.rules
物理機設定:
# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4c:90:06:83", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x10ec:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4c:10:cd:ab", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
虛機設定:
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:37:f8:69", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:37:f8:73", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
2、vi/etc/sysconfig/network-scripts/ifcfg-eth*中的device=eth*也修改成與MAC對應的值
3.修改完後一定要記得reboot重啟一下才會生效。