6

I've been trying to get my Ubuntu Server VM running through VirtualBox. I ended up trying several network interfaces because of some networking issues and finally got it working. However, I noticed that my machine is now using eth3 instead of the default eth0. There are some scripts on this VM that are linked to eth0 and I'd like to reset the driver to eth0. How would I do this?

I've attempted to run the various networking commands to stop the network and configure eth0 without success. Ubuntu appears to be keeping a tally of all network drivers that I've attempted and increments the interface each time I use a new driver. Because of this, the system takes longer to boot up because it's searching for eth0 primary network interface in /etc/network/interfaces

Highway of Life
  • 496
  • 1
  • 7
  • 14

1 Answers1

13

Ubuntu Server has some custom udev rules in place that allow it to "cache" the ethernet devices that have been plugged in to the machine. The delay you're experiencing is caused, as you suspect, in the /etc/network/interfaces file. While it may be viable to constantly add new devices to the file, in your case, you just want to remove Ubuntu's ethernet cache:

rm -f /etc/udev/rules.d/70-persistent-net.rules

Which will restart your network interfaces back to eth0 on the next boot.

Caleb Gray
  • 350
  • 3
  • 8
  • 1
    You shouldnt delete this file. Just open it at text editor "sudo vim / sudo nano" and remove lines with wrong or removed network cards and then just make a correct name you yours interface like eth0/eth100/card0 – MealstroM Jan 26 '12 at 12:50
  • 5
    @MealstroM I like the idea of deleting it since it is an auto-generated file, it will be recreated on startup. Just to be on the safe side, I backed the file up before removing it, and confirmed there is no issue with removing it. I wanted a good "reset" for the VM and this worked perfectly. :) – Highway of Life Jan 27 '12 at 02:44
  • 1
    This is no longer recommended on ubuntu 15.10 or newer http://unix.stackexchange.com/questions/335461/how-to-change-network-card-on-ubuntu-16-04 – spuder Jan 06 '17 at 19:21