How to rename Ethernet devices through udev
This document (3012993) is provided subject to the disclaimer at the end of this document.
Environment
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
- 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 - Open /etc/udev/rules.d/30-net_persistent_names.rules for editing. The names of the Ethernet devices are listed in this file.
- 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
- 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"
- Save the file.
- 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 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
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com