Rename Network Interface or Ethernet

Rename Network Interface or Ethernet

Many of the laptops running Linux has the wireless network interface named as wlan0. Being used to old style Linux network interface many would prefer to see it as ethX, for instance eth1.

The most recommended method to Rename Network Interface or Ethernet would be using udev.

udev is basically the device manager for Linux Kernel. Responsible for managing all the devices nodes listed under /dev. Introduced in Linux 2.5 kernel, udev succeds devfs. It pretty much takes care of all the devices which are added and/or removed from the system.

We will now try to rename network interface or ethernet wlan0 to eth1.

The first step would be identify the device by it’s MAC address.

Rename Network Interface or Ethernet – Locate the MAC address for network interface or ethernet

Using ifconfig, we will locate the MAC address for the device in question. The following command will provide you the MAC address we are looking for.

[root@gagan ~]# /sbin/ifconfig wlan0 | grep -i hwaddr

The output should look provide the MAC address for the network interface wlan0. It should look something like below:

Output:

wlan0      Link encap:Ethernet  HWaddr 90:00:6e:5a:ef:9e

Note the MAC address we got above as it will be used further in this process.

Now, let’s proceed with renaming the network interface wlan0.

Rename Network Interface or Ethernet

Now, we need to edit the file 70-persistent-net.rules, which should be located under /etc/udev/rules.d/. This file maintains the persistent names for network interfaces, which ensures the network interface name remains persistent after the reboot as well.

[root@gagan ~]# vim /etc/udev/rules.d/70-persistent-net.rules

Locate the MAC address we noted earlier. The line containing the MAC address should look like something below:

# PCI device 0x14e4:0x4357 (brcm80211)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="90:00:6e:5a:ef:9e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

We need to replace the existence of NAME=”wlan0″ with NAME=”eth1″.

Save the file and reboot in order to ensure the persistent changes prevail post reboot.

[root@gagan ~]# reboot

Post reboot, verify the changes in the ifconfig command.

No Comments

Post a Comment

Time limit is exhausted. Please reload CAPTCHA.