Skip to content

Renaming network device names in linux without reboot

2 April 2013

English: 3Com Fast Ethernet XL PCI 10/100BASE-...

Sometimes when you messing around with network interfaces of Linux box, you end up with only one Ethernet adapter but instead of eth0 as you maybe expect it is still with eth1 or eth2 etc. Most often this is side result of cloning virtual machine or replacing a LAN card of physical machine.

Some people coming from the broken Windows world try to remedy this with restart but soon unpleasant surprise is discovered: the operating system still is in same state as before restart. Prime suspect in this endeavour is a udev. This is system which ensure that in no matter what order your computer load your interfaces, their names are consistent between reboots. That way your ISP interface always have correct configuration as well as all other lan cards. I had this problem in past with old (atm VERY old) Slackware distro and it wasn’t pretty, believe me.

Good news is that you can change it quick and easy.

Configuration of udev device can be found in plain text config file. For current CentOS 6 and many other distribution it’s location is: /etc/udev/rules.d/
Proper Ethernet device is recognized by it’s MAC address. Find the string ethX at the end of a row and replace it with something you wish. Simple as that.

To apply changes to a system, you can follow the advice of countless sites to restart your computer, or you can choose to do it without reboot.

Much more faster and conveniently  with:

udevadm control --reload-rules ; udevadm trigger

commands and have desired effect immediately. You can check this with:

ip a

All you have left probably to do is to configure your newly created device according to your needs. To do this follow your distribution of choice, recommended way and tools.

Advertisement

From → Linux

One Comment

Trackbacks & Pingbacks

  1. What is the correct way to restart udev?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: