Saturday, April 24, 2010

Switch NIC order without reboot (Suse)

Let's say we have two nics installed on our system, eth0, and eth1.
At some times latter, you removed eth0 from the system/replaced it's board.
Now eth1 is the only nic in your machine... and you want to rename this nic (eth1 as eth0).

This is how it's done:

# rcnetwork stop
# vi /etc/udev/rules.d/30-net_persistent_names.rules


Through udev configuration we can change the systems nic order as we desire:

SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k eth1"


 Let's change eth1, as eth0,
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k eth0"

Save and exit the file.

Now execute the following command
# /lib/udev/rename_netiface
i.e
# /lib/udev/rename_netiface eth1 eth0



Now, restart rcnetwork, and we're done:
# rcnetwork start

No comments: