Ubuntu: Network driver reset to eth0

linux-networkingnetworkingUbuntuvirtual-machinesvirtualbox

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

Best Answer

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.