8

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?
10

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.

  • Right. VirtualBox fakes a "bridge" to the wireless network. It will never work to actually bridge to a wireless client, because the AP will reject frames with MAC addresses that haven't associated to it. – Michael Hampton Jul 10 '18 at 12:58
5

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)

  • "the culprit is bridge-utils, which works by setting the NIC that is being bridged in promiscous mode." Any chance you could link to one or more reputable sources about this, to add weight to this claim and/or to provide further reading for anyone wanting to know more? Thanks :) – sampablokuper Mar 8 '18 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.