VirtualBox inbound network connections failing

networkingvirtualbox

I have a virtual development server running Ubuntu Server set up with Apache and running under VirtualBox on a Mac (host OS is OSX 10.8.1). I have a bridged adapter configured in an attempt to make it visible from my test devices (iPhone and Android) inside the network.

When I connect to the server from the "real" machine that's running it, everything's fine – webpages can be loaded, etc. However, connection attempts to this server from any of my test devices time out.

I tried setting promiscuous mode = allow all and restarting the guest OS, but it doesn't seem to have had any effect. I've also verified that the host box's firewalls are completely off (at the command line using 'sudo ipfw list' and in System Preferences > Security > Firewall).

Is there any additional setup I ought to have done in order to make this work? What additional troubleshooting steps am I missing?

Best Answer

OK, earlier I wrote that using the Mac's wireless interface en1 simply doesn't working with bridging. I only have anecdotal evidence, but since you were able to verify it, we can take it as a fact.

But let's have a look at the available documentation, which is interesting for itself. Maybe someone else can comment on that?

I had a look at the documentation which was shipped with VirtualBox 4.1.20 (r80170). It says in chapter 6.4 Bridged networking:

To enable bridged networking, all you need to do is to open the Settings dialog of a virtual machine, go to the “Network” page and select “Bridged network” in the drop down list for the “Attached to” field. Finally, select desired host interface from the list at the bottom of the page, which contains the physical network interfaces of your systems. On a typical MacBook, for example, this will allow you to select between “en1: AirPort” (which is the wireless interface) and “en0: Ethernet”, which represents the interface with a network cable.

OK, this seems to imply, that en1 should be working. But, just the next paragraph says:

Note: 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. When VirtualBox sees an incoming packet with a destination IP address that belongs to one of the virtual machine adapters it replaces the destination MAC address in the Ethernet header with the VM adapter’s MAC address and passes it on. VirtualBox examines ARP and DHCP packets in order to learn the IP addresses of virtual machines.

OK? I'm not too sure about the capabilities of the airport card, but when I run tcpdump I see the message en1: promiscuous mode enable succeeded in dmesg. (Although I can't see any traffic which isn't mine, or multi- or broadcast. Meh)

Now, the fun part:

Depending on your host operating system, the following limitations should be kept in mind: On Macintosh hosts, functionality is limited when using AirPort (the Mac’s wireless net- working) for bridged networking. Currently, VirtualBox supports only IPv4 over AirPort. For other protocols such as IPv6 and IPX, you must choose a wired interface.

I can imagine that Oracle made assumptions about the capabilities. Or, it used to work at some point (back when SUN was still in charge) and doesn't do any more with recent Macs or OSX-versions. I'm wildly guessing there, because it never worked for me.

Related Topic