Monday, January 11, 2010

Howto change NIC order in Linux (SUSE 10)

I recently had an issue with a mother board that was replaced on some server, after renaming the configuration file to the correct MAC address (ifcfg-eth-id-00:1a:64:7a:d0:be), the new NIC was recognized as eth4, (and not eth0 as previously),after digging abit in the depths of the OS I have found a solution:

/etc/udev/rules.d/30-net_persistent_names.rules

Through this file you can configure the NIC order by MAC address.
For example:

SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:1a:64:7a:d0:be", IMPORT="/lib/udev/rename_netiface %k eth0"

To change take place you will probably need to reboot the machine so udev will re-read it's configurations(restarting networking service is not enough).