Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to name a newly added NIC as eth4. How can I do that under Linux?

To be specific, the distribution I use is SUSE, SP1. I guess there is a one to one mapping between the NIC hardware and the ethx like name?

share|improve this question
    
Did you manage to rename the NIC using the solution I propose below? –  jaume Jan 31 '13 at 8:40

1 Answer 1

(This applies to SuSE Linux Enterprise Server 10 and 11.)

The file you're looking for is /etc/udev/rules.d/30-net_persistent_names.rules.

Its contents look like this:

SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="0b:a0:c0:ff:ee:bb", IMPORT="/lib/udev/rename_netiface %k ethX"
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="de:ad:be:ff:0b:bb", IMPORT="/lib/udev/rename_netiface %k ethY"

Locate the line that applies to your new ethernet interface (it is the line in which the SYSFS{address} entry coincides with the MAC address of the new NIC), replace ethX with eth4 and save the file.

Now we must take care of any existing configuration files.

Change directory to /etc/sysconfig/network/ and look for a file called ifcfg-eth-<MAC address of new network interface>. Open it and, if present, replace:

DEVICE=ethX

with

DEVICE=eth4

If you can't find a file named ifcfg-eth-<MAC address of new network interface> but you see files with pattern ifcfg-ethXX look for the file that contains the MAC adress of the new NIC:

grep "<MAC adress of new NIC>" ifcfg-eth*

(MAC adress should be in format 00:11:22:33:44:55.)

replace as explained above the DEVICE entry (if present) and rename the file to ifcfg-eth4.

If you didn't find any file either named ifcfg-eth-<MAC address of new network interface> or ifcfg-ethXX that's OK, this simply means it wasn't configured automatically.

Reboot the computer. You should see now an interface called eth4.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.