To prevent NIC name drift when you use a private image to create ECSs, you need to delete files from the network rule directory of the VM where the ECS or image file is located during the private image creation.
When registering an external image file as a private image, delete files from the network rule directory on the VM where the external image file is located. You are advised to delete the files on the VM and then export the image file.
An OS and VirtIO drivers have been installed on the ECS.
ls -l /etc/udev/rules.d
Example:
rm /etc/udev/rules.d/30-net_persistent-names.rules
rm /etc/udev/rules.d/70-persistent-net.rules
The italic content in the commands varies depending on your environment.
For CentOS 6 images, to prevent NIC name drift, you need to create an empty network rule file.
Example:
touch /etc/udev/rules.d/75-persistent-net-generator.rules //Replace 75 with the actual value in the environment.
lsinitrd /boot/initrd-2.6.32.12-0.7-default |grep persistent|grep net
cp /boot/initrd-2.6.32.12-0.7-default /boot/initrd-2.6.32.12-0.7-default_bak
mkinitrd
lsinitramfs /boot/initrd.img-3.19.0-25-generic|grep persistent|grep net
cp /boot/initrd.img-3.19.0-25-generic /boot/initrd.img-3.19.0-25-generic_bak
update-initramfs -u