Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 2 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


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.