Hi Everyone,
I'm a web developer and a system administrator running VirtualBox on a Macbook. I have a question I was hoping you might be able to answer...
I created a virtual machine, exported it, and made two copies of those files. Then, I imported those two copies of the virtual machine back into VirtualBox (I just wanted two Ubuntu servers that were exactly the same).
It works great, except both virtual machines end up with the same IP address when I spin them up.
My question: what is causing this and how do I fix it (so that they both have unique IP addresses)?
Duplicated Virtual Machines Have Same IP Address
-
jzimmerlin
- Posts: 3
- Joined: 4. Aug 2010, 03:58
- Primary OS: Mac OS X Leopard
- VBox Version: OSE other
- Guest OSses: Ubuntu
-
frank
- Oracle Corporation
- Posts: 3362
- Joined: 7. Jun 2007, 09:11
- Primary OS: Debian Sid
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Linux, Windows
- Location: Dresden, Germany
- Contact:
Re: Duplicated Virtual Machines Have Same IP Address
I assume that both VMs are set up to use a NAT network (see VM settings). In that case both VMs will receive the standard IP 10.0.2.15. This is completely normal. Just imagine that VBox provides dedicated routers for both VMs. So the guests can access the internet but from their own subnet. But the guests are not directly visible from the internet.
-
sej7278
- Volunteer
- Posts: 1003
- Joined: 5. Sep 2008, 14:40
- Primary OS: Debian other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Solaris, Linux, Windows, OS/2, MacOSX, FreeBSD
- Contact:
Re: Duplicated Virtual Machines Have Same IP Address
or if bridged networking is being used and you're using dhcp on your lan (yuk) then you've not changed the mac address on the copy and they're getting assigned the same ip based on ethers.
-
jzimmerlin
- Posts: 3
- Joined: 4. Aug 2010, 03:58
- Primary OS: Mac OS X Leopard
- VBox Version: OSE other
- Guest OSses: Ubuntu
Re: Duplicated Virtual Machines Have Same IP Address
It's working now!
It turns out the whole thing was a Ubuntu issue, not a VirtualBox issue. Ubuntu didn't like it when I changed the MAC address in VirtualBox. After I did that, eth0 wouldn't show up when running ifconfig. Only lo showed up. So, I ran ifconfig -a and that revealed eth0 had been renamed eth2. I then went into /etc/network/interfaces, changed all references to eth0 to eth2, rebooted, and all is well now.
Thank you for your help!
P.S. I am using bridged networking and DHCP, since it's only for internal development and testing, and not for production.
It turns out the whole thing was a Ubuntu issue, not a VirtualBox issue. Ubuntu didn't like it when I changed the MAC address in VirtualBox. After I did that, eth0 wouldn't show up when running ifconfig. Only lo showed up. So, I ran ifconfig -a and that revealed eth0 had been renamed eth2. I then went into /etc/network/interfaces, changed all references to eth0 to eth2, rebooted, and all is well now.
Thank you for your help!
P.S. I am using bridged networking and DHCP, since it's only for internal development and testing, and not for production.
-
frank
- Oracle Corporation
- Posts: 3362
- Joined: 7. Jun 2007, 09:11
- Primary OS: Debian Sid
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Linux, Windows
- Location: Dresden, Germany
- Contact:
Re: Duplicated Virtual Machines Have Same IP Address
Ok, that Ubuntu issue is a known problem. It saves the assignment of MAC <==> ethX using an udev rule. Have a look at /etc/udev/rules.d and you will find a file 70-persistent-net.rules there. You can savely remove this file. This file is auto-generated by /lib/udev/rules.d/75-persistent-net-generator.rules. You can remove that file as well. From now on, the guest will no longer store the assignment between the MAC and ethX interface.
-
jzimmerlin
- Posts: 3
- Joined: 4. Aug 2010, 03:58
- Primary OS: Mac OS X Leopard
- VBox Version: OSE other
- Guest OSses: Ubuntu
Re: Duplicated Virtual Machines Have Same IP Address
Thanks for the tip!
-
mmb
- Posts: 1
- Joined: 13. Jan 2011, 03:56
- Primary OS: Ubuntu other
- VBox Version: OSE Debian
- Guest OSses: linux
- Contact:
Re: Duplicated Virtual Machines Have Same IP Address
That was recently fixed in Ubuntu for vmware: https://bugs.launchpad.net/ubuntu/+sour ... bug/341006
Maybe it could also be fixed for Virtualbox mac addresses?
Maybe it could also be fixed for Virtualbox mac addresses?