Renaming network device names in linux without reboot
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.
Trackbacks & Pingbacks