首页 > 代码库 > Linux虚拟机克隆后网卡找不到问题
Linux虚拟机克隆后网卡找不到问题
解决虚拟机克隆网卡丢失问题
1.克隆后的虚拟机网卡显示如下
[root@ser5 桌面]# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:120 errors:0 dropped:0 overruns:0 frame:0
TX packets:120 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:9340 (9.1 KiB) TX bytes:9340 (9.1 KiB)
2.解决办法如下
(1)启用eth1网卡
[root@ser5 桌面]# cd /etc/sysconfig/network-scripts/
将eth0重命名为eth1
[root@ser5 network-scripts]# mv ifcfg-eth0 ifcfg-eth1
[root@ser5 network-scripts]#vim /etc/udev/rules.d/70-persistent-net.rules
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address} =="00:0c:29:a9:a0:68", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address} =="00:0c:29:28:e5:6a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
修改eth1的mac地址
将NAME=“eth1”的 ATTR{address}值替换掉ifcfg-eth1的mac地址
WADDR=00:0c:29:28:e5:6a
重新启动网络服务
[root@ser5 network-scripts]# service network restart
正在关闭接口 eth1: [确定]
关闭环回接口: [确定]
弹出环回接口: [确定]
弹出界面 eth1: Determining if ip address 192.168.4.5 is already in use for device eth1...
[确定
(2)启用eth0网卡
[root@ser5 network-scripts]#vim /etc/udev/rules.d/70-persistent-net.rules
将NAME=“eth0“的两行配置信息删除
然后将NAME=“eth1“该成NAME=“eth0“并复制其ATTR{address}的值
[root@ser5 network-scripts]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
将其mac地址修改为刚刚复制的ATTR{address}的值
重新启动网络服务
[root@ser5 network-scripts]# service network restart
正在关闭接口 eth0: [确定]
关闭环回接口: [确定]
弹出环回接口: [确定]
弹出界面 eth0: Determining if ip address 192.168.4.5 is already in use for device eth1...
[确定]