牛下载:绿色软件官方软件免费下载基地!
所在位置:首页 > 新闻资讯 > kvm直接拷贝qcow2虚机文件到另一个虚机启动的问题

kvm直接拷贝qcow2虚机文件到另一个虚机启动的问题

发布时间:2020-04-25 21:21:25来源:阅读:

场景是这样的:

实体机是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,重启一切搞定。

反对
收藏
  • 热门资讯
  • 最新资讯
  • 应用排行榜
  • 游戏排行榜