Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am looking for a solution to the problem one encounters on motherboards with dual Ethernet ports or computers with identical Ethernet interface cards. How can one force a particular adapter port to always be the same device name, e.g. Eth0. In practice, the same port is not assigned the same device name by the kernel on power up, making power failures and remote management problematic.

This is similar to the problem that exists with hard disks. Now one can use the UUID to force that drive to keep the same device name. I'm looking for a similar solution to the Ethernet problem.

share|improve this question

migrated from stackoverflow.com Aug 11 '09 at 16:37

This question came from our site for professional and enthusiast programmers.

2 Answers 2

With udev you can create a mapping from mac addresses to device names. On my Ubuntu Jaunty system I have a file /etc/udev/rules.d/70-persistent-net.rules that contains lines like this:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="11:22:33:44:55:66", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

This file was created by my distro, I did not need to change it manually.

share|improve this answer
    
Upvoting as this is a much more general solution than the one provided by Stuart, which would only work on RH based distros. –  Insyte Aug 11 '09 at 17:36

create the NIC and open the config file for it, some like /etc/sysconfig/network/ifcfg-eth1 or 2 or 3. in the file will be something like hardware="00:11:22:33:44:55" this is the MAC address of the card. rename the file to ifcfg-eth0 and make sure that it contains this line, this will make sure that this NIC is always eth0. if ifcfg-eth0 already exists then you will need to rename this too to something like ifcfg-eth1.

share|improve this answer
    
This answer only applies to Redhat, or redhat-like OSes (such as Fedora core, CentOS etc). If that's the OP's OS, then this answer will work fine. –  Daniel Lawson Aug 12 '09 at 9:40

Your Answer

 
discard

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