How to rename Ethernet devices through udev

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

Environment

SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Desktop 10

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 the
SLES 10 Installation and Administration Guide - Chapter 24, Dynamic Kernel Device Management with udev.

Related documentation
 

Disclaimer

This Support Knowledgebase provides a valuable tool for 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-2008
  • Modified Date:23-Feb-2021
    • SUSE Linux Enterprise Desktop
    • SUSE Linux Enterprise Server
    • SUSE Linux Enterprise Real Time Extension

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center