我们在KVM上clone一个linux虚拟机后,一般都会更改一下网卡的MAC,使用一个规划好的MAC,以方便今后的管理。但经常会发现linux虚拟机里原来是eth0的网卡设备没有了,变成了eth1。而且不管你怎么重启改配置都改不回来。有解决办法吗?
要解决上面的问题其实很简单,只要更改下面的文件,把里面的内容全部注释掉,再重启一下VM就可以了。
[root@vmongodb02 ~]# cat /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}=="00:01:02:03:01:04", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"**