Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have two computers which are supposed to be identical hardware. However on one machine, the ethernet port shows up as "eth1" whereas on the other it appears as "eth2".

I am trying to manage an Ubuntu image to work on both of these machines, but the /etc/network/interfaces config file needs to be configured differently on each.

One solution would be to just put both ethernet port names in the config file. This works, in that it gives me an ethernet connection, but having an incorrect port in the config file causes a long delay (>1minute) in the failsafe boot delay upstart job.

Is there some way I can let it detect which port to use automatically?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The system stores persistent device names in /etc/udev/rules.d/. The culprit is probably a file in that directory named 70-persistent-net.rules. I think you can simply rename the port on one of your machines, rename any conflicts, reload the scripts, restart networking... or, you know, reboot.

share|improve this answer
    
70-persistent-net.rules was specifying mac addresses for ports. I deleted all entries bar one, and replaced the mac address with "?*" and now it seems to always give me eth0. Thanks! –  Alex Sep 23 '13 at 23:34
    
You're welcome! A thought: Normal rules map something unique about the resource to a friendly name like eth0, and by persisting ensure consistency. For a NIC then, MAC address-to-eth-something. If the wild card works, great! But I would expect troubles if your machine ever saw two NICs at once. –  Salt Sep 26 '13 at 2:44

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.