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.
I would like to thank user slm for guiding me in the right direction in setting up the guest network in the KVM. I will add the screen shots to the answer so that it will be more informative.
I assume the virt-manager
package is installed and also the host machine is setup with the necessary packages for KVM to work.
Preparing the Network For Guest to Host Interaction
The main step in the KVM is setting up of the network. If the machine is not available in the network, then it serves no purpose, be it physical or virtual.
Type virt-manager
in the terminal. The console would show up as
below.
Click on Edit -> Connection Details and a new screen would pop
up as below.
Click on Virtual Networks tab and from there click on the +
button to add a new network to the KVM guests.
Click on Forward and then we would be presented with the below
screen. Now, the IPV4 addresses we choose here is completely up to
our choice and we could optimize this step to suit our actual needs.
After we click on Forward in the above screen, we would be presented
with the below screen. In this step, it basically tells the address
space available for us.
In this step, choose forwarding to physical network and select the
host's network interface which will help the guests to interact
with the outside world.
After the above step, we are almost done and we just would be
presented with the below screen, which is kind of a review of all
the details we chose so far.
Adding this new device to our Guest OS
From the initial screen of virt-manager
, click on the Open
and
we will be presented with a screen as below.
From the above screen, click on the i to open up another screen as
below.
Click on Add Hardware and select Network. In the Network tab, select the host device as our newly created network in the previous step and click on Finish as shown in the below screen.
Testing in the guest OS
Now, inside the guest OS make sure that you are able to ping
the host machine and outside network such as google. If the ping succeeds, then we have successfully setup our network in the guest OS.
References
The reference material used to setup the guest network
Best Answer
You should be able to use the user-mode networking stack. Start qemu like this:
The important options:
-net nic
: Show a virtual network card for the guest-net user
: Make the qemu process on the host communicate over the real network just like any other process wouldnet=10.0.0.0/8
: The subnet on the virtual networkhost=10.0.0.1
: The host IP address on the virtual networkhostfwd=tcp:127.0.0.1:2222-10.0.0.2:22
: The qemu process on the host listens for TCP connections from localhost on port 2222 and forwards them to the virtual network to 10.0.0.2:22 (so you can ssh to your new virtual machine)On the guest run
Test SSH from host to guest
and from guest to host
Test the internet reachability from the guest
The host process works like a NAT router. Only TCP and UDP traffic will work. In particular ping only works between the guest and the host you can't ping google.com (my usual network testing method). The advantage of this approach is that you don't even need root privileges.