All Products
Search
Document Center

:What do I do if NIC drifts occur on a Linux instance that has multiple NICs?

Last Updated:Apr 27, 2026

Fix NIC-to-MAC-address mismatches after adding or removing NICs on a multi-NIC Linux ECS instance.

Symptom

Adding or removing a NIC on a multi-NIC Linux ECS instance may cause a mismatch between NIC device names and their media access control (MAC) addresses. This mismatch is called a NIC drift.

In the following example, the instance has eth1 (MAC 00:16:3e:10:bd:1b) and eth2 (MAC 00:16:3e:0c:92:df). Running ip addr shows eth1 with the MAC address of eth2, indicating a NIC drift.NIC name drift

Cause

NIC information is stored in /etc/udev/rules.d/70-persistent-net.rules. A NIC drift occurs when this file is missing or contains incorrect entries.

Solution

Important
  • Before you perform high-risk operations, such as modifying the configurations or data of an Alibaba Cloud instance, check the disaster recovery and fault tolerance capabilities of the instance to ensure data security. We recommend that you create snapshots in advance. For information about snapshots, see Overview.

  • If you granted specific users the permissions on sensitive information, such as usernames and passwords, or submitted sensitive information in the Alibaba Cloud Management Console, we recommend that you modify the sensitive information at the earliest opportunity.

Edit /etc/udev/rules.d/70-persistent-net.rules to bind each NIC device name to its correct MAC address.

  1. Connect to the Linux ECS instance.
  2. Go to the /etc/udev/rules.d directory:
    cd /etc/udev/rules.d
  3. Open the /etc/udev/rules.d/70-persistent-net.rules file:
    vi 70-persistent-net.rules
  4. Bind each NIC device name to its MAC address:
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="<MAC address of the NIC>", KERNEL=="eth*", NAME="<Device name of the NIC>"
    For example, to bind eth1 to MAC address 00:16:3e:10:bd:1b:
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:16:3e:10:bd:1b", KERNEL=="eth*", NAME="eth1"
  5. Verify the NIC configurations in /etc/udev/rules.d/70-persistent-net.rules:
    cat 70-persistent-net.rules
    Expected output:Bind NIC name to MAC address

    The output confirms that eth1 maps to MAC address 00:16:3e:10:bd:1b. No NIC drift occurs.