Wifi card on Ubuntu in VirtualBox, no wireless extensions [duplicate]
VirtualBox does not natively offer Wireless support (Like a virtualized Wireless device). Instead, it connects directly to the Wireless device the Host uses. In this guide I will point to the steps needed to have a working Wireless card for you Guest. Before we begin you need to make sure you have done the following points:
Installed the Extension Pack for that particular VirtualBox Version. You can find the extension pack in the Download section of VirtualBox. To install it, open VirtualBox, go to the menu and select File --> Preferences. Now select Extensions and select the Add Pack button at the far right. Look for the downloaded Extension pack and add it to VirtualBox.
-
You have added your user to the vboxusers group. The quickest way is to go to the terminal and type:
sudo usermod -a -G vboxusers cyrex
where cyrex is my username. In this case, you would change cyrex for yours. Note that if the
vboxusers
group is not found it is because VirtualBox is not yet installed on your system.
Now to proceed with the steps. This is what is called a passthrough method:
-
Right click on the Virtual Environment you wish to edit and select **Settings*:
-
Go to the Network section and select an Adapter. In this case I selected Adapter 1 although it is recommended to select a second Adapter, this way, you can use the wireless connection to your Host and still be able to connect to your internal Virtualized network (Connect to other virtualbox guests internally). For the example mentioned here I connected directly using the first adapter.
Click on the Attached To option and select Bridged Adapter. This will open an option that will show your Host network interfaces. If your host iw Linux it will show something like
wlan0
,wlan
,eth2
... If your Host is a Mac, it will showAirPort
. In the image you can seewlan0
for this case:Now simply accept and run your virtualized environment. You should connect and see it similar to this:
I should mention the following:
On Mac and Linux hosts, functionality is limited when using AirPort (the Mac's wireless networking) or any Wireless Linux device to bridged networking. Currently, VirtualBox supports only IPv4 over Mac's AirPort or Linux Wireless devices. For protocols such as IPv6 and IPX, you must choose a wired interface.
Some adapters strip VLAN tags in hardware. This does not allow to use VLAN trunking between VM and the external network with pre-2.6.27 Linux kernels nor with host operating systems other than Linux.
I should also mention that in the following extended options:
You can select how you wish to interpret the Host's wireless device. If you wish to see it as a Intel network device, a PcNet device or a Paravirtualized Network device. Note that Promiscuous mode is used more often for sniffing and can create a bit of network lag on both, the Guest and Host when using it.
Note that if you disconnect in the Guest OS, you are only disconnecting the Guest to Host virtualized connection. You are not disconnecting or turning off your Host's Wireless device. For more information regarding VirtualBox and networking see this guide.
Using the method above, with a PCI Wireless device on the host or a USB Wireless device is the same. The VirtualBox Network settings will detect the device the same way. I am testing this right now with the Edimax EW-7811Un. It was detected as wlan1
and Virtualbox (On the Network settings) detected the device as such. Remember that one thing is how the "outside" of the virtual environment works and then another how it works inside. Inside it was shown as a "Wired" device and I have internet through it.
Now, if you want to access a USB device do the following (Note that you need the Extension Pack for this):
-
Once the virtual OS has started select the device from the USB option on the bottom:
-
It will appear on the Desktop after a couple of seconds:
-
If you want the USB device to be present from the beginning, then go to the USB Settings option and select the Enable USB 2.0 Controller then add the device you wish to have activated with the Add Filter From Device option at the right (The one with the Green Plus sign).
Now I want to add that the difference between the VirtualBox Extension Pack and the Guest Addition is that, apart from the USB support and Remote Display options that the Extension Pack brings the Guest Addition provides the following:
- Better Mouse Integration
- Better 3D Support
- Copy/Paste Support between Host and Guest
- Folder Sharing between Host and Guest
So if you need any of this features, you need to also install the Guest Addition. If you only need access to a USB Device or network options, with the Extension alone you will have that.
Note that VirtualBox does NOT provide a virtualized Wireless device inside the guest. They will all look like a wired one, even if the host is providing the connection via a Wired or Wireless card. Something like this:
If you want to use the connection as wifi in the guest, you need to use the passthrough method as said in the comments but if you only want to connect your guest, you don't need to do that.
Assuming your wifi connection works on the host system, you can simply in virtualbox manager on the host go to network configuration of your guest. On adaptor 1 tab, select bridge mode and on Name field, you select the wifi connection on your host. The connection will appear as wired connection eth0 on your guest and will work as if it were a wired connection. The wifi part will be managed by the host OS.