Deleting Files in the Network Rule Directory
Scenarios
To prevent NIC name drift on the edge instance you will create using a private image, you need to delete files in the network rule directory of the VM where the source edge instance is located during the private image creation.
Prerequisites
The xen-pv and virtio drivers have been installed on the edge instance.
Procedure
- View the files in the network rule directory.
ls -l /etc/udev/rules.d
- Delete the files with both persistent and net included in file names from the network rule directory.
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 rules configuration file.
Example:
touch /etc/udev/rules.d/75-persistent-net-generator.rules //Replace 75 with the actual value in the environment.
- Delete network rules.
- If the OS uses the initrd system image, perform the following operations:
- Check whether the initrd image file whose name starts with initrd and ends with default contains the persistent and net network device rule files (replace the italic content in the following command with the actual OS version).
lsinitrd /boot/initrd-2.6.32.12-0.7-default |grep persistent|grep net
- If no, no further action is required.
- If yes, go to 3.b.
- Back up the initrd image files (replace the italic part in the following command with the actual OS version).
cp /boot/initrd-2.6.32.12-0.7-default /boot/initrd-2.6.32.12-0.7-default_bak
- Generate the initrd file again.
- Check whether the initrd image file whose name starts with initrd and ends with default contains the persistent and net network device rule files (replace the italic content in the following command with the actual OS version).
- If the OS uses the initramfs system image (such as Ubuntu), perform the following operations:
- Check whether the initramfs image file whose name starts with initrd and ends with generic contains the persistent and net network device rule files.
lsinitramfs /boot/initrd.img-3.19.0-25-generic|grep persistent|grep net
- If no, no further action is required.
- If yes, go to 3.b.
- Back up the initrd image files.
cp /boot/initrd.img-3.19.0-25-generic /boot/initrd.img-3.19.0-25-generic_bak
- Generate the initramfs image file again:
- Check whether the initramfs image file whose name starts with initrd and ends with generic contains the persistent and net network device rule files.
- If the OS uses the initrd system image, perform the following operations:
Last Article: Common Operations
Next Article: Detaching Data Disks from an Edge Instance
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.