Rename an interface without a network or system reboot

I need to rename an ethernet interface on a machine after dynamically adding it to the machine.

Related tags: Linux VMware

Credit: Original Poster

Rename eth2 to eth4.
Create the ifcfg-eth4 file:

DEVICE=eth4
BOOTPROTO=static
ONBOOT=yes
HWADDR=00:00:00:00:00:A1
IPADDR=10.1.2.3
NETMASK=255.255.255.0

Create/edit the udev rule for the device in /etc/udev/rules.d/70-persistent-net.rules:

KERNEL=="eth?", SYSFS{address}=="00:00:00:00:00:A1", NAME="eth4"


Reload the udev rules and apply it (RHEL 5):

udevcontrol reload_rules
udevtrigger

Newer udev:

udevadm control --reload-rules
udevadm trigger

Bring up the interface:

ifup eth4

Rating: 2

Propose a different solution...