场景是这样的:

实体机是kvm,上面跑了A和B两台虚机。

A 机 IP 是 192.168.85.40,然后胡乱鼓捣,里面乱作一团,然后想恢复。

B 机 IP 是 192.168.85.47,全新安装。

想直接把 B 机的qcow2文件翻版覆盖A机,然后启动改个 ip 即可。

结果是不行,用 virsh console A 上去查看,发现 eth0 没了,多了一个 eth1 。

于是明白,网卡冲突了,解决方法如下:

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 0x1af4:0x1000 (virtio-pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="f0:00:c0:a8:55:2f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x1af4:0x1000 (virtio-pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="f0:00:c0:a8:55:28", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"  

看到了吧,eth1 的地址是 f0:00:c0:a8:55:28 ,把这行删掉,把上面 eth0 的地址改成 f0:00:c0:a8:55:28即可。

顺手改了ifcfg-eth0和network,重启一切搞定

comments powered by Disqus