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?
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?
(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
.