Help Center/ Elastic Cloud Server/ FAQs/ Network Configuration FAQ/ What Should I Do If NIC Flapping Occurs After My ECS Specifications Are Modified?
Updated on 2024-09-26 GMT+08:00

What Should I Do If NIC Flapping Occurs After My ECS Specifications Are Modified?

Symptom

Take a Linux ECS as an example. After the user modified ECS specifications and ran the ifconfig command, the user found that the original eth0 and eth1 NICs were changed to eth2 and eth3 NICs, indicating that NIC flapping occurred.

Root Cause

NIC flapping occurs because NIC retaining is enabled in the image from which the ECS is created.

Solution to Linux

For a Linux ECS, perform the following operations and restart the ECS to resolve this issue:

  1. Run the following command to view the files in the network rule directory:

    ls -l /etc/udev/rules.d

  2. Run the following commands to delete the files with both persistent and net included in file names from the network rule directory:

    rm -fr /etc/udev/rules.d/*net*persistent*.rules

    rm -fr /etc/udev/rules.d/*persistent*net*.rules

  3. Run the following command to check whether the initrd image file with a name starting with initrd and ending with default contains both persistent and net network rules (change the italic data in the following command to the actual OS version):

    lsinitrd /boot/initrd-2.6.32.12-0.7-default |grep persistent|grep net

    • If yes, go to steps 4 and 5.
    • If no, no further action is required.
  4. Run the following command to back up the initrd image file (change the italic data in the following command to the actual OS version):

    cp /boot/initrd-2.6.32.12-0.7-default /boot/initrd-2.6.32.12-0.7-default_bak

  5. Run the following command to regenerate the initrd image file:

    mkinitrd

Perform the following operations when an OS, such as Ubuntu, uses the initramfs image:
  1. Run the following command to check whether the initramfs image file with a name starting with initrd and ending with generic contains both persistent and net network rules:

    lsinitramfs /boot/initrd.img-3.19.0-25-generic|grep persistent|grep net

    • If yes, go to steps 2 and 3.
    • If no, no further action is required.
  2. Run the following command to back up the initrd image file:

    cp /boot/initrd.img-3.19.0-25-generic /boot/initrd.img-3.19.0-25-generic_bak

  3. Run the following command to regenerate the initramfs image file:

    update-initramfs -u