Novell Home

Renaming a NIC

Novell Cool Solutions: Tip
By Muhammad Sharfuddin

Rate This Page

Reader Rating  stars  from 23 ratings

Digg This - Slashdot This

Posted: 29 May 2007
 

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.

Reader Comments

  • great tip
  • very useful, and well documented
  • superb Tip...saves the day
  • It is really very use full tip and will work our reall life vironment.
  • I was searching for such a nice tip, Thanks Muhammad
  • very useful tip - nicely explained
  • Awesome tip, thanx :)
  • I like SUSE 10.2 - but not 'everything' makes sense to a newbie - great tips like these help me keep my sanity. With so many distro's to support... and so little time... I just hope that SUSE 11.x will build in 'full' control of the HW / SW / Registry into Yast. I've been telling 'everyone' that openSUSE 10.x is sooo much better cuz you don't need to re-learn all of your sysadmin tricks to 'do the job' - just use the Yast instead... that was until I tried to clone/image one of my servers (using identical hw) - and ended up with phantom NICs that forced my new NICs to become eth3/4 etc. Not a big deal for me - just the end-users whining about 'why' they have phantom NICs. Since I usually have multiple NICs; I like to give then intelligible names - that identify the networks they are connected to - So this Tip is really worth DOUBLE points (or Two Tips in One). THANX - Muhammad Sharfuddin for putting this GREAT TIP together :-)
  • Very cool one. Thanks

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

Novell® Making IT Work As One

© 2008 Novell, Inc. All Rights Reserved.