Wireless bridged networking in KVM. Why is it so complicated?

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.

  • Bridging a Wireless Card in KVM/QEMU
  • Bridge wireless cards

KVM, as any other native Linux software, tries to use existing code instead of reinventing the wheel. This is what makes it so much better than all the other solutions, due to the availability of software for Linux and the speed it gets updated and enhanced with, but this also gives it the limitations of the other solutions.

In this case, the culprit is bridge-utils, which works by setting the NIC that is being bridged in promiscous mode. Lots of the wireless NICs' drivers under linux simply don't support that mode, but that is by no means the fault of KVM.

You still have the option of using NAT or OVS or anything else KVM supports (and there are plenty of technologies available)