Problem:
Say you have installed two NICs in your system e.g. eth0 and eth1 and sometime later you removed one of the nics from your machine, say, eth0.
Now you want to access the remaining nic, eth1, as eth0, or you want to simply name the existing nic (i.e. eth1) as eth0.
Solution:
Here are the steps to follow:
# rcnetwork stop # vi /etc/udev/rules.d/30-net_persistent_names.rules
here you find a line as
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k eth1"
simply change eth1, to eth0:
SUBSYSTEM==”net”, ACTION==”add”, SYSFS{address}==”00:02:b3:22:84:f3″, IMPORT=”/lib/udev/rename_netiface %k eth0″
Now execute the following command:
# /lib/udev/rename_netiface <old> <new>
i.e.
# /lib/udev/rename_netiface eth1 eth0 # rcnetwork start
DONE
We can give any valid name to our nic, say e.g. we want to rename our eth0 to lan0, then
# rcnetwork stop # vi /etc/udev/rules.d/30-net_persistent_names.rules
here you find a line as
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k eth0"
simply change eth1, to lan0:
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k lan0"
Now execute the following command:
# /lib/udev/rename_netiface eth0 lan0
NOTE: If you gave your nic a name as lanX, nicX, or intX(i.e non ethX name), and then want to change the name from lan0 to eth0, all the above steps are required, and reboot too.
One Response to Renaming a NIC on SUSE and openSUSE