How to rename Ethernet devices through udev

  • 3012993
  • 04-Jan-2008
  • 14-Nov-2012


Novell SUSE Linux Enterprise Server 10
Novell SUSE Linux Enterprise Desktop 10
Novell Open Enterprise Server 2 (OES2)
Novell openSUSE


  • ethX was replaced with a new NIC. The new NIC is showing as ethY, but it needs to have the same name as the replaced ethX.
  • A virtual machine was cloned and eth0 does not show, but an eth1 does.
  • Business rules dictate that interface X needs to be known by a certain name.
  • A wireless NIC is showing as wlanX but needs to appear as ethX.


Renaming Ethernet devices is done through udev.
  1. Identify the hardware MAC address of the Ethernet device:
    ifconfig CURRENT_DEVICE_NAME | grep HWaddr
    The output after "HWaddr" is the physical hardware address. Sample output:
    eth0 Link encap:Ethernet HWaddr 00:1A:4B:B7:31:13
  2. Open /etc/udev/rules.d/30-net_persistent_names.rules for editing. The names of the Ethernet devices are listed in this file.
  3. Locate and identify the line with the NIC from step 1. It may look like this:
    SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:1a:4b:b7:31:13", IMPORT="/lib/udev/rename_netiface %k eth0
  4. From the step above, the text after "IMPORT="/lib/udev/rename_netiface %k" is the name of the Ethernet device. Change this as needed. In this example, the interface eth0 will be renamed to eth5:
    SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:1a:4b:b7:31:13", IMPORT="/lib/udev/rename_netiface %k eth5"
  5. Save the file.
  6. Reboot to test changes.

Additional Information


udev manages the device tree /dev. It can handle hotplugging (the dynamic addition and removal of devices, for instance plugging in a USB stick) and provides a way to have persistent naming across reboots and hardware configuration changes. For more information on udev, please refer to chapter 24, Dynamic Kernel Device Management with udev of the SLES 10 Installation and Administration Guide.

Related documentation