paul's picture

One of the things I do quite often is make a clone of a Ubuntu server vdi image that I made in the past so that I can do some testing on a fully setup Ubuntu server image. When the testing is over, I would normally delete this image. Using this clone image, I make a new Virtual Box machine with a bridge network - as I would normally want to access the server from my host machine as a server.
One problem that I alway encounter is that the new bridge adaptor - it is new as it has a different MAC address - would be interprited by Ubuntu as a new network card and assigned to eth1 instead of eth0. This completely breaks the static network I have setup in /etc/network/interface. So I have no network except localhost. eth0 no longer exist and so it not working. eth1 is not configured - so it is not working.
I would prefer to keep my network interface as eth0 on this virtual machine and not have different ethx on different Virtualbox Ubuntu servers.
The solution involves editing /etc/udev/rules.d/70-persistent-net.rules
There you will find (in my case), 2 udev rules - one for the old virtual network card (no longer in existance) and another for the new virtual network card:

  1. Delete the udev rule line for the old network card
  2. Edit the udev rule for the new network card and change NAME="eth1" to NAME="eth0"

 
Restart the network (or reboot) and new virtual network card is now eth0

Comments

Thanks very much

No doubt you saved me at least an hour! TY.

Thanks for the solution

I had this issue on a non-virtual server after replacing a network card.
Do you have any idea what makes these rules? I would like to prevent this from happening when replacing the NIC another time.

Nevermind. I found the answer

Nevermind. I found the answer in a comment in /etc/udev/rules.d/70-persistent-net.rules.