Linux母盘Clone无法联网
2016年11月26日 运维日记:Linux母盘Clone无法联网(适用于Hyper-V,VMWARE,KVM等),虚拟化封装的母盘,因为网卡MAC地址的原因,导致直接克隆出的小鸡仍然是旧的MAC地址,从而无法联网。
具体现象:
解决方案:
一、首先vim /etc/udev/rules.d/70-persistent-net.rules
1 2 3 4 5 6 7 8 9 10 |
# 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 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:8f:89:97", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:50:bd:17", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1" |
找到eth1网卡的mac地址00:0c:29:50:bd:17。
二、然后vi /etc/sysconfig/network-scripts/ifcfg-eth0
将 DEVICE=”eth0″ 改成 DEVICE=”eth1″ ,
将 HWADDR=”00:0c:29:8f:89:97″ 改成上面的mac地址 HWADDR=”00:0c:29:50:bd:17″
最后,重启网络
1 2 |
service network restart #centos6 systemctl retsart network #centos7 |
附:更简洁的把设备描述信息,保留eth1新mac地址即可,然后把eth0对应新mac地址重启网络即可!