0

Here's what I'm running:

  • MacOS Mojave 10.14.4
  • VirtualBox v6.0.6 r130049
  • Ubuntu 18.04.2 LTS Server as a Guest VM

I'm trying to get 2 adapters running: NAT and Bridged.

Initially I started with first adapter (adapter1) running NAT mode, configured enp0s3 as DHCP using netplan inside Ubuntu, and I was able to access external machines and the internet.

Then I added a second adapter (adapter2), configured enp0s8 as DHCP using netplan inside Ubuntu, but I wasn't getting an IP address on that interface.

After many hours of playing around with this setup, I decided to switch back to only using adapter1 configured as bridged adapter. And suddenly I'm getting IP address from my router on my local network. ...I then added back adapter2 configured as NAT and everything seems okay now.

Any idea why DHCP in bridged mode ONLY works with adapter1? If I have NAT on adapter1 and Bridged on adapter2, it doesn't work. But if I have Bridged on adapter1 and NAT on adapter2, suddenly I'm getting DCHP to work on adapter1 only.


Here's a follow-on issue. So I have a clone of the VM, and even though I regenerate MAC addresses on each of these adapters, I'm getting the same IP address back from the router for both VMs! :(

I'm fairly certain my trouble is coming from the fact that I have cloned these VMs. I found if I do a fresh Ubuntu installation of these VMs, then I get unique IP addresses.

Overall I'm finding the virtual networking in VirtualBox to be quite frustrating.

1 Answer 1

0

Ok, I think I have a handle on this. After many hours trying to figure what the heck is going on with the same IP addresses on both VMs, I found this post:

https://unix.stackexchange.com/questions/419321/why-are-my-cloned-linux-vms-fighting-for-the-same-ip

After changing the machine-id, I'm now able to get different IP addresses assigned to each VM.

The fact that I couldn't configure DHCP on the bridged adapter2 was just an illusion. I was suddenly getting an IP address on adapter1, when I only had one of the VMs running. Once I powered-on the second VM I had trouble getting an IP address likely due to the same machine-id's showing up on the network.

To make matters worse, and probably less related to the resolution here, I realized my Wifi router is on the fritz and the connection comes and goes. So I was chasing my tail on trying to figure out why I could connect to the IP occasionally.

1
  • ok...My next issue to solve is after I reboot, I always have to manually run dhclient to obtain an IP address on the enp0s8 (adapter2). :( Commented May 16, 2019 at 17:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .