Page 1 of 1

Getting unique IP addresses for Cloned guests

Posted: 18. May 2016, 05:55
by dlanced
So that I can access VBox guests from my LAN, I have VBox attach guests to a bridge. This works perfectly for standalone guests, which get a usable IP from my DHCP server. The problem is that when I clone a guest - regardless of whether it's full or linked - it always comes up with the same dynamic IP that the source had. This happens even when I generate a new MAC address manually through the VBox Network Settings menu. I launch a lot of guests so I really don't want to have to create static IPs for each one - they're bound to conflict eventually.
Any ideas?
Thanks,

Re: Getting unique IP addresses for Cloned guests

Posted: 18. May 2016, 08:23
by socratis
dlanced wrote:This happens even when I generate a new MAC address manually through the VBox Network Settings menu.
Just out of curiosity, why don't you do it during the clone operation? That would be the best place/time in my opinion. Anyway, standard troubleshooting instructions follow.

Please read the following: Minimum information needed for assistance. As far as the "VBox.log.zip" goes, here's what you do:
  1. Start the VM. Not from a saved or suspended state. Clean start.
  2. Take the steps required to generate/observe the error.
  3. Record the error message. EXACTLY. Post a screenshot if you have to.
  4. Shut down the VM (if it hasn't aborted by itself). Not suspended, not paused. Shut down. If you can't shut it down by normal means, close the VM window and select "Power off".
  5. Right-click on the VM in the VirtualBox Manager.
  6. Select "Show Log..."
  7. Save it (just the first log, VBox.log), ZIP it and attach it in your response (see the "Upload attachment" at the bottom of the form).
I'll need to see two versions of the "VBox.log", one from the original VM and one from the Mini Me clone that exhibits the problem.

Re: Getting unique IP addresses for Cloned guests

Posted: 18. May 2016, 09:15
by mpack
dlanced wrote:The problem is that when I clone a guest - regardless of whether it's full or linked - it always comes up with the same dynamic IP that the source had.
This can only be pilot error.

It isn't actually a VirtualBox question. When you use bridged mode VirtualBox isn't handing out IP addresses, your router is. The fact that you got an IP address in the correct range proves that you are communicating with the router, which is where VirtualBox's part ends. Now if the router is handing up the same IP address to multiple MACs then you should certainly contact your router maker about that... but I rather suspect that isn't happening. I consider it rather more likely that you have created multiple VMs with duplicated MACs, and whatever procedure you are using to change MACs is done after the event.

Re: Getting unique IP addresses for Cloned guests

Posted: 18. May 2016, 15:18
by dlanced
socratis wrote:
dlanced wrote:This happens even when I generate a new MAC address manually through the VBox Network Settings menu.
socratis wrote:Just out of curiosity, why don't you do it during the clone operation? That would be the best place/time in my opinion. Anyway, standard troubleshooting instructions follow.
I actually did it during the clone operation as well.
socratis wrote:Please read the following: As far as the "VBox.log.zip" goes, here's what you do:
Thanks! I've attached both logs and the output of VBoxManage showvminfo ubuntu16-Clone.

Re: Getting unique IP addresses for Cloned guests

Posted: 18. May 2016, 15:24
by dlanced
mpack wrote:
dlanced wrote:The problem is that when I clone a guest - regardless of whether it's full or linked - it always comes up with the same dynamic IP that the source had.
This can only be pilot error.

It isn't actually a VirtualBox question. When you use bridged mode VirtualBox isn't handing out IP addresses, your router is. The fact that you got an IP address in the correct range proves that you are communicating with the router, which is where VirtualBox's part ends. Now if the router is handing up the same IP address to multiple MACs then you should certainly contact your router maker about that... but I rather suspect that isn't happening. I consider it rather more likely that you have created multiple VMs with duplicated MACs, and whatever procedure you are using to change MACs is done after the event.
I'm pretty sure you're correct: it does seem to be a problem with the MAC address not being changed but, as I mentioned in my reply to Socratis, I did tell VBox to chance the MAC curing cloning.
By the way, in the "NAT Network Details" dialog, VBox offers "Supports DHCP" as an option: does that mean it will allow VMs to connect to an external DHCP server, or that VBox will create its own DHCP server? If it's the former, then that might be a better option for me than attaching to a bridge.
Thanks,

Re: Getting unique IP addresses for Cloned guests

Posted: 18. May 2016, 15:52
by mpack
NAT (standard or NAT network) has its own DHCP server.

Re: Getting unique IP addresses for Cloned guests

Posted: 18. May 2016, 15:58
by dlanced
mpack wrote:NAT (standard or NAT network) has its own DHCP server.
Thanks. I guess that won't help me, then: I can't have two DHCP servers messing around with my LAN. :)

Re: Getting unique IP addresses for Cloned guests

Posted: 18. May 2016, 19:14
by socratis
OK, let's look at some of the information from the logs:
• Your clone is a linked clone based on the "ubuntu16-template". Correct?
• You do have different MAC addresses, indeed. Template: 08 00 27 d2 8f 40, Clone: 08 00 27 ed 72 39.
• You connect the template to the Bridged network to adapter "veth6YUG1Q", while you connect the clone to adapter "vethM4LIHI".

Now, I really don't understand the last part. First of all your adapters have ... "funky" names and second, they are ... different. They shouldn't be. Did you leave out some details from your story?

Finally, could you please post the output of 'ifconfig' from the template and this specific clone?

Re: Getting unique IP addresses for Cloned guests

Posted: 18. May 2016, 20:00
by dlanced
socratis wrote:OK, let's look at some of the information from the logs:
• Your clone is a linked clone based on the "ubuntu16-template". Correct?
• You do have different MAC addresses, indeed. Template: 08 00 27 d2 8f 40, Clone: 08 00 27 ed 72 39.
• You connect the template to the Bridged network to adapter "veth6YUG1Q", while you connect the clone to adapter "vethM4LIHI".

Now, I really don't understand the last part. First of all your adapters have ... "funky" names and second, they are ... different. They shouldn't be. Did you leave out some details from your story?
Ah, yes. The bridge names. Those are virtual bridges created by my LXC host. They're available and easy to apply, but for some reason their names change every time I reboot.
socratis wrote:Finally, could you please post the output of 'ifconfig' from the template and this specific clone?
I've attached a file with ifconfig from both template and clone...and the LXC bridge from my host, for that matter.
Thanks!
UPDATE: the file didn't seem to attach, so here are its contents:

Code: Select all

ubuntu@ubuntu-template:~$ ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:d2:8f:40  
          inet addr:10.0.3.166  Bcast:10.0.3.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fed2:8f40/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:593 errors:0 dropped:0 overruns:0 frame:0
          TX packets:397 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:733496 (733.4 KB)  TX bytes:35626 (35.6 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:160 errors:0 dropped:0 overruns:0 frame:0
          TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:11840 (11.8 KB)  TX bytes:11840 (11.8 KB)

===================
[Clone:]
ubuntu@ubuntu16b:~$ ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:ed:72:39  
          inet addr:10.0.3.166  Bcast:10.0.3.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feed:7239/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:561 errors:0 dropped:0 overruns:0 frame:0
          TX packets:394 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:730829 (730.8 KB)  TX bytes:35223 (35.2 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:160 errors:0 dropped:0 overruns:0 frame:0
          TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:11840 (11.8 KB)  TX bytes:11840 (11.8 KB)

=================

LXC bridge interface from my host:
lxcbr0    Link encap:Ethernet  HWaddr fe:43:11:63:6f:30  
          inet addr:10.0.3.1  Bcast:10.0.3.255  Mask:255.255.255.0
          inet6 addr: fe80::f465:82ff:fedb:b209/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4089 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4354 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:286089 (286.0 KB)  TX bytes:1759748 (1.7 MB)


Re: Getting unique IP addresses for Cloned guests

Posted: 18. May 2016, 21:27
by dlanced
I've got it working now: as you suspected, it seems that the bridge I chose was the problem. When I selected eth0 and regenerated my MAC address, I got a new DHCP IP.
Thanks,

Re: Getting unique IP addresses for Cloned guests

Posted: 18. May 2016, 22:24
by socratis
dlanced wrote:
socratis wrote:Did you leave out some details from your story?
Ah, yes. The bridge names.
For your benefit, and other that might read this thread, this was one of the really bad examples of how (not) to report a problem. You left out the most vital piece of information, which had me scratching my head for quite some time. No one here assumed that you were using a software bridge. That changes names between reboots! Who knows what else?

It's like calling your art-class teacher, complaining about not being able to paint these beautiful sceneries any more, because you think you've lost the feeling, but you "forget" to mention that you've lost your arms in the mean time!