Bridged Network: No IP address on Guest OS

What I want:

I want a virtual machine guest running Ubuntu (on VirtualBox) for various web development test servers (running on different ports, e.g. Grunt.js is running on port 9000).

  • I want to test web applications running on these servers a) from within the guest b) from within the host (running Windows 7, btw), c) from other devices in the same network, connected via WiFi (e.g., mobile devices)
    • I want to be able to access the Internet from within the guest

I was first running a solution where I had both a NAT and a Host-only adapter configured in VirtualBox, which was fine for accessing the guest from the host and for accessing the Internet from within the guest.

Now that I want other devices to be able to access the virtual machine, this solution doesn't work anymore. I was able to do this years ago with a bridged network adapter, but that doesn't seem to work here.

What I did:

I set up bridged networking as the only network adapter in VirtualBox and left the default settings. When I boot up the guest, the WiFi symbol in the upper right keeps flashing, i.e., the arrows don't show up. After a while it says: "Disconnected - you are now offline". This is the output of ifconfig:

eth0      Link encap:Ethernet  HWaddr 08:00:27:71:92:9c  
          inet6 addr: fe80::a00:27ff:fe71:929c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:233 errors:0 dropped:0 overruns:0 frame:0
          TX packets:103 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:16083 (16.0 KB)  TX bytes:22280 (22.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:32 errors:0 dropped:0 overruns:0 frame:0
          TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2624 (2.6 KB)  TX bytes:2624 (2.6 KB)

As you can see, no inet4 address. I thus cannot ping the host from within the guest and vice versa.

I also tried this, i.e. I changed the MAC address and ran

sudo rm -rf /etc/udev/rules.d/70-persistent-net.rules

sudo reboot

Didn't change anything at all.

What else can I do to debug this? I suspect it's a DHCP problem. I can easily get an IP on my host and other machines in the network, but not on the guest.


It is doable with VirtualBox, I got the same config running recently, Windows 7 host, Arch Linux guest, on a laptop with wifi. As you said, that's when giving a bridged networking to the guest. I also chose virtio driver for the virtual card, but I doubt that's related with the topic at hand.

The guest gets an IP from any router the host happens to connect to, it's working seamlessly, and come to think of it it's very impressive. I tried to achieve the same on Xen host and haven't been able to. So it's coming from some magic from VirtualBox drivers, the only public description being here: http://www.virtualbox.org/manual/ch06.html#network_bridged.

Bridging to a wireless interface is done differently from bridging to a wired interface, because most wireless adapters do not support promiscuous mode. All traffic has to use the MAC address of the host's wireless adapter, and therefore VirtualBox needs to replace the source MAC address in the Ethernet header of an outgoing packet to make sure the reply will be sent to the host interface. [...] VirtualBox examines ARP and DHCP packets in order to learn the IP addresses of virtual machines.

This driver extension should be open source since it's not mentioned in the "Oracle VM VirtualBox Extension Pack", but it's pretty hard to find documentation about it. Unfortunately I don't know how to troubleshoot it, but I would try to:

  1. Look at the properties of the host wireless card, check if you see the virtualbox stuff there (I reinstalled the machine since, so I can't check what are the additional items exactly)
  2. Uninstall and reinstall the wireless card. It's likely to remove the additional items, so I would assume that deactivating / reactivating bridged networking in the VM properties would reinstall that part.

Also if the router is yours, you can have a look at its log, see if at least it gets some tentative connections from the guest.


Edit: You commented that it's working with another router/access point? In this case it's possible that some routers refuse to allocate more than one IP to the same MAC address. It's a shame I don't have the machine anymore, to see if the MACs for each IP in the router are the same, but that should be the case.


The IEEE 802.11 standard requires APs to reject packets from unknown MAC addresses; the client must do an 802.11 Authentication and Association first, before the AP can accept data packets from it. So if "bridged mode" means your VM or guest OS is trying to use a second MAC address over the same radio card, it must make sure the second MAC address is getting 802.11 authenticated and associated, otherwise the AP has to ignore the packets from the second MAC address.

Is there documentation for how VirtualBox deals with this issue? This has to be a well-known problem that's either been solved (and there should be documentation of how it was addressed), or it should be well documented that "bridged mode over Wi-Fi is not supported".