解决 Error:No suitable device found: no device found for connection "System eth0"
问题:直接复制另一台电脑的centos6.8虚拟机过来,配网络的时候,使用#service network restart,出现 Error:No suitable device found: no device found for connection "System eth0" 使用#ifconfig发现,只有“eth1”跟“lo”,查看/etc/sysconfig/network-scripts/下,有ifcfg-eth0文件在,却没有ifcfg-eth1,估计是因为复制虚拟机的过程中导致虚拟网卡的mac地址改变,系统不能发现eth0,给新网卡指定为 eth1
解决方法: 第一步 #vim /etc/udev/rules.d/70-persistent-net.rules
将原网卡mac替换为新网卡mac,并删除最后三行# PCI device 0x8086:0x100f
(e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:eb:6e:86", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
另外 还需修改网卡的配置文件
#vim /etc/sysconfig/network-scripts/ifcfg-eth0
将HWADDR= 后的原mac改为新mac,并且要注意的是网卡的UUID也必须改过来,网卡UUID的查看方法如下
查看网卡UUID:
nmcli con show 或 nmcli con list
nmcli con show 或 nmcli con list
查看网卡mac地址:
nmcli dev show 或 nmcli dev list
nmcli dev show 或 nmcli dev list
注:show用于7版本;list用于6版本;
然后再重启虚拟机
重启后输入#ifconfig 发现eth0回来了,#service network restart 也都是ok