Wireless bridged networking in KVM. Why is it so complicated

kvmvirtual machinevirtualboxvmwarewifi

I've been using VirtualBox (and sometimes VMWare) for years and I've never had any problem with the virtual network adapters, no matter if the physical ones were wired or not.

I also played some time ago with KVM in a wired set-up and, although I had to edit some configuration files to get it working, I could also create a bridged adapter without any major problems.

Today I decided (wrongly, it seems) to try to use KVM in a laptop running Ubuntu 13.10 and tried to create a virtual machine with bridged networking over a wireless interface. It was extremely painful to set this up.

After following all the tutorials I found (for example) and having to reboot my laptop several times to get the connection back I just gave up and went back to my old well-known VirtualBox.

And, actually, the first thing I noticed when I looked into the official KVM documentation was that they discourage from trying to bridge a wireless adapter since, according to them:

The here shown method, will not work with most(all?) wireless drivers, as these do not support bridging.

So, my question is:

  • How come they say that most wireless adapters do not support bridging if it works in VirtualBox and VMWare just "out-of-the-box"?
  • And what's the difference between these hypervisors that makes it so complicated in KVM, if it works at all?

Best Answer

Background on KVM

I think this is partly due to expectations with KVM. KVM is first and foremost a server product and not a desktop product for virtualization. It can be used in either application but it's definitely suited more for being used on a server.

I use it on 3+ hosts at work each hosting 5-10 VMs apiece and it has run flawlessly and is easy to manage, and basically just works.

Question #1

How come they say that most wireless adapters do not support bridging if it works in VirtualBox and VMWare just "out-of-the-box"?

I believe you're drawing this conclusion from this blurb on the KVM website.

WARNING: The here shown method, will not work with most(all?) wireless drivers, as these do not support bridging.

This statement is here because it is typically the case. I believe this is often why when you install VirtualBox or VMWare there are typically kernel modules that are getting installed and these products provide their own wrapping around doing this to facilitate making it easier. These products are essentially working around these issues.

I believe this issue is also a driver issue. The drivers for WiFi under Linux still pales in comparison to the support that's provided by the Windows drivers for the same hardware. That's just a fact of life.

NOTE: I've had wireless NICs in the past that I was not able to put into bridge mode in the past as well. I've typically worked around the issue by either using VirtualBox or getting a different NIC for my laptop.

I'll also highlight that neither VirtualBox nor VMware could do this either, at least not until more recent versions. See this as evidence from VMware's KB:

If your host has a wireless network adapter, you cannot use bridged networking on Linux hosts in VMware Workstation 5 or lower, VMware Server 1.x, any version of GSX Server, any hosts in VMware Workstation 3 or lower, or in VMware GSX Server 2 or lower. Under these products, if you want to run virtual machines on a host that uses wireless Ethernet adapters, you must configure your virtual machines to use NAT or host-only networking.

Source: Using bridged networking with a wireless NIC (760)

Question #2

And what's the difference between these hypervisors that makes it so complicated in KVM, if it works at all?

I can't really shed any light on this particular question, other than to say that if it was easy I imagine this feature would be enabled. I think the crux of the issue has to do with this feature requiring 3 or more groups to coordinate their efforts (hardware manuf., driver devs., Linux kernel, & KVM).

These situations are often what results when you need multiple groups to work together in the open source world (IMO)!

So can I set it up or what?

You can set this up following the directions from either of these 2 articles. The setup requires using a TUN/TAP device which can be put into bridge mode.

Related Question