1

I'm trying to setup my Ubuntu guest VM as a server that can be accessed from outside my host. I've tried setting up bridged adapter but with little success.

First I created the the bridged connection:

enter image description here

I then selected the new Network Bridge in my VM settings:

enter image description here

When i now run my guest VM, the IP is the same as my host IP and the connection lags:

enter image description here

What am I doing wrong?

1
  • 3
    do you have a reservation for your PC in your DHCP server? it may be seeing the same MAC for the host and guest external nic, and assigned the same number as a result. Commented Nov 17, 2017 at 20:08

2 Answers 2

7

You attached the virtual machine to a Wi-Fi adapter. Regardless of what bridging method you use – Windows-provided or VirtualBox-provided (your screenshot shows both in use simultaneously) – trying to bridge Wi-Fi will cause the same general problem: It does not allow the host to lie about its MAC address.

Even though the virtual machine thinks it has its own MAC address, the host bridge has to quietly rewrite it on all outgoing packets (thus implementing "layer 2 NAT" or "arpnat"). This is needed because the Wi-Fi frame headers require the radio transmitter to identify itself, and don't allow clients (stations) to fill in a source address different from the transmitter's.

(Ethernet does not have this problem. Wi-Fi has an optional mode which solves the problem, called "4addr" aka "WDS bridge", but both the client and AP must support it.)

The end result, as @FrankThomas noted, is that your router (DHCP server) sees the same MAC requesting addresses both times. Depending on the router's configuration (e.g. static reservation or out of spite), it might always offer the same address for the same MAC.

(Yes, DHCP requests carry their own copy of the source MAC, independently from the L2 header... but I seem to remember that at least VirtualBox's arpnat implementation rewrites that as well. I'm not entirely sure.)

If you indeed have static DHCP leases, one possible solution would be to bind them to the "Client ID" instead of the MAC address. A standards-compliant DHCP server must distinguish between requests with different Client IDs, even if they come from the same MAC address. (And vice versa, the same "Client ID" must be associated with the same lease even if the MAC address is different.)

1
  • Excellent! So, I took this to mean I should change from using the WiFi adapter in Bridged adapter Settings to the wired interface available... I also refreshed the MAC addr just to be safe. Worked like a charm!
    – kaiwan
    Commented Dec 21, 2022 at 6:38
0

I would guess that the MAC address on both virtual machines is the same. Did you create one as a copy of the other? Generate a new MAC address for one of them and try again.

You must log in to answer this question.

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