How to forward a WiFi adapter to a virtual machine

Virtualization has become an integral part of the work of system administrators and enthusiasts, allowing them to run isolated operating systems on top of the main one. However, standard network configurations often operate in NAT or bridge mode over a physical Ethernet port, ignoring wireless interfaces. For security auditing, driver testing, or working with specific Wi-Fi equipment, direct access to the hardware module from within the guest OS becomes urgently needed.

Forwarding USB devices, which include external WiFi adapters, is technically complex due to the specifics of hypervisor architecture. By default, a virtual machine doesn't see the physical host hardware, perceiving only the emulated network card. To change this behavior, control of the device must be intercepted at the host kernel level and transferred to the virtual environment, which requires installing additional extension packages and fine-tuning filters.

It's worth noting right away that wireless modules built into laptops, connected via PCIe or M.2 interfaces, are practically impossible to pass through without complex manipulations with the passthrough of entire controllers (PCI Passthrough), which are available mainly in KVM/QEMU on Linux. Therefore the main object Our instructions will focus on external USB WiFi adapters, which are the most affordable and flexible solution for such tasks.

Before starting setup, ensure you have administrator rights on the host and the latest version of virtualization software installed. The process will vary depending on the platform you choose, whether it's Oracle VM VirtualBox, VMware Workstation, or a Type-I hypervisor like Hyper-V. In this guide, we'll cover the most common scenarios applicable to current software versions.

⚠️ Note: Virtualization software interfaces and menu item names may vary slightly depending on the product version. If you don't see the option described, consult the developer's official documentation or check for updates.

Selecting the right hardware and drivers

The success of the entire operation depends 90% on the selected WiFi adapter. Not all USB devices work correctly in passthrough mode, especially if monitor mode or packet injection is required. The key factor here is the chipset installed inside the adapter and the availability of stable drivers for it in the guest operating system. Popular chipsets from Realtek, Atheros (Qualcomm) and Ralink (MediaTek) are usually the best supported.

When purchasing equipment, it is worth paying attention to the support of standards 802.11ac And 802.11ax, although good old N-adapters are often sufficient for specific pentesting tasks. It's important that the device supports the required operating modes at the driver level. A virtual machine doesn't add new capabilities to the hardware; it merely extends existing functions.

📊 What type of WiFi adapter do you plan to use?
External USB whistle
Built-in laptop module
Specialized adapter for auditing
Virtual Host Adapter

Before connecting to a virtual machine, ensure that the host has the necessary drivers installed to at least detect the device in Device Manager. Without this step, the hypervisor will not be able to take control. After installing the drivers on the host, it is recommended to disable automatic network connections to prevent the host system from using the interface during tests.

Setting up passthrough in Oracle VM VirtualBox

VirtualBox is one of the most popular desktop virtualization solutions due to its free and cross-platform nature. However, it doesn't support USB device forwarding out of the box. To enable this feature, you need to install Extension Pack, the version of which must strictly match the version of the main software. It can be downloaded from the developer's official website.

After installing the extension pack and restarting the program, go to the settings for the specific virtual machine. You are interested in the section USBHere you need to activate the USB controller by selecting the version USB 3.0 (xHCI) Controller, since most modern adapters operate according to this standard to ensure high data transfer rates.

Next, you need to create a device filter. By clicking the add new filter icon on the right, you'll see a list of connected USB devices. Select your WiFi adapter from the list. The system will create a rule that will automatically remove the device from the host when the virtual machine starts.

☑️ Checking VirtualBox settings

Completed: 0 / 4

It's important to understand that once a device is captured by the host, it will become unavailable to the guest OS, and vice versa. This is normal behavior. If the adapter doesn't appear in the device list or is marked as "Unknown," try changing the PID/VID filter manually by copying the values ​​from Windows Device Manager.

Configuring VMware Workstation and Player

VMware products are renowned for their stable operation with peripherals. The USB redirection mechanism is implemented more natively and often doesn't require additional packages, unlike VirtualBox. To get started, ensure the USB Arbitrator service is running on the host. This service is responsible for redirecting requests between the physical machine and the virtual environment.

Connect the WiFi adapter to your computer and start the virtual machine. In the lower right corner of the VMware window, look for the icon displaying the status of connected devices (often looks like two monitors or a USB plug). Clicking it will display a list of available devices. Find your adapter in the list and select the option. Connect (Disconnect from Host).

After selecting the device, VMware will disconnect it from the host system and emulate a connection within the guest OS. Windows or Linux within the virtual machine should emit a hardware connection sound and begin searching for drivers. If the drivers are already installed in the guest system, the device will immediately appear in the list of network interfaces.

⚠️ Warning: Switching devices may cause brief power interruptions on the USB port. Do not remove the physical adapter while it is connected to the virtual machine, as this may cause the USB controller on the host to freeze.

To automate the process, you can set up rules in the configuration file. .vmx, adding a line usb.autoConnect.device0 = "TRUE", however, for one-off tasks, manual switching via the menu is sufficient. VMware also allows you to connect devices by Vendor ID and Product ID, which is convenient if you have several identical devices.

Working with the Hyper-V hypervisor

The situation with Hyper-V is radically different from its competitors. This type-one hypervisor, built into Windows by default does not support Forwarding individual USB devices to guest machines. The Hyper-V architecture isolates guest OSs from the hardware layer to a greater extent than other types of products. Direct forwarding of a USB WiFi adapter using traditional methods is not possible here.

However, there are workarounds. The first option is to use the function Enhanced Session Mode, which allows resource forwarding, but it's primarily focused on input peripherals and disks, not network adapters. A second, more effective option for networking tasks is to create an External Virtual Switch, which will forward the host's physical Ethernet port. However, this won't provide access to the WiFi radio module for specific tasks.

To fully utilize WiFi in Hyper-V, users often resort to third-party utilities such as USB Network Gate, which forward USB ports over the network, emulating a local connection. You can also consider using WSL2 (Windows Subsystem for Linux), which in the latest versions of Windows 10 and 11 has gained support for forwarding USB devices via the command line. usbipd.

Using USBIPD on Windows

The usbipd utility allows you to forward USB devices to WSL2 or remote machines. To do this, you need to install the server part on the host and the client part on Linux. The command usbipd bind --busid makes the device available for forwarding, and usbipd attach connects it. It's a complex but powerful tool for working in a Hyper-V environment.

Resolving typical errors and conflicts

Even with proper configuration, users often encounter issues where a device is either not detected or operates erratically. One of the most common causes is a driver conflict. The driver on the host and the driver in the guest OS can conflict when attempting to control the same hardware simultaneously. Ideally, the driver for this device on the host should be removed or the device should be disabled in Device Manager before starting the VM.

Another common issue is insufficient USB resources. If you have a lot of peripherals connected, the controller may not provide enough current or address space for the WiFi adapter, especially if it's a powerful device with an external antenna. In this case, using a powered USB hub with its own power supply will help.

Below is a table to help diagnose common problems:

Symptom Probable cause Solution method
The device is not visible in the USB VM list. Extension Pack (VirtualBox) is not installed Install the extension pack of the same version
Error Code 43 in Device Manager Driver failure or power shortage Reconnect the device, check the USB power
The adapter connects and immediately disconnects Driver conflict on the host Uninstall the device driver on the host OS
Slow speed or connection interruptions USB bus overload or interference Use USB 3.0 port, extension cable

If the device is detected as "Unknown Device," try changing the connection port. USB 3.0 ports (blue) sometimes work more reliably with modern adapters than USB 2.0 ports. It's also worth checking whether the USB service is disabled in the motherboard BIOS, although this is rare for workstations.

Features of working in Linux (KVM/QEMU)

In the Linux world, especially when using the KVM and