22/01/15

Rename network cards in Ubuntu

Hi,
there is a moment in a life of a sysadmin when he/she want to rename the name of each network card in a server to understand in which cable this network card is connected or simply because they've had enough to see eth0, eth1,ethX.

In these cases it's possible to rename the name of network card. How ?
First you have to get the MAC address to the card you want to rename, i.e. 00:11:22:33:44:55

Now, create a file in /etc/udev/rules.d with the name 70-persistent-net.rules and write the follow line


SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:11:22:33:44:55", KERNEL=="eth*", NAME="hte1"


Where hte1 it's the new name you want to call the network card.

It's time to restart the server to apply the modify ...or... just run the follow command

# /etc/init.d/networking stop && modprobe -r driver_name && udevadm control --reload-rules && udevadm trigger && modprobe driver_name && /etc/init.d/networking start
See you next.