Linux Rename Eth0 Network Interface Card Name [ Udev ]

In Linux, you can change the name of a network interface card using the udev subsystem.

Here’s how you can change the name of the eth0 interface to new_name:

  1. Create a new udev rule file: sudo nano /etc/udev/rules.d/10-network.rules
  2. Add the following lines to the file:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="new_name"

where xx:xx:xx:xx:xx:xx is the MAC address of the eth0 interface, and new_name is the desired name of the interface.

  1. Save the file and exit the editor.
  2. Reload the udev rules: sudo udevadm control --reload-rules
  3. Verify the changes by using the ip command: ip addr show

Note: The new name will take effect only after a reboot or by bringing the interface down and up again: sudo ip link set dev eth0 down && sudo ip link set dev eth0 up

This method of renaming network interfaces using udev rules is persistent across reboots, and is preferred over using the traditional ifconfig or ip commands.

Leave a Comment