Novell Home

My Favorites

Close

Please to see your favorites.

How to rename Ethernet devices through udev

This document (3012993) is provided subject to the disclaimer at the end of this document.

Environment

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

Situation

  • 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.

Resolution

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

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


Disclaimer

This Support Knowledgebase provides a valuable tool for NetIQ/Novell/SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:3012993
  • Creation Date:04-JAN-08
  • Modified Date:14-NOV-12
    • NovellOpen Enterprise Server
    • SUSESUSE Linux Enterprise Desktop
      SUSE Linux Enterprise Real Time Extension
      SUSE Linux Enterprise Server

Did this document solve your problem? Provide Feedback