How to connect Kali Linux to WiFi in VirtualBox

Virtualization is the de facto standard for working with information security tools, allowing potentially dangerous processes to be isolated from the main operating system. However, when transferring a distribution Kali Linux into a virtual environment Oracle VM VirtualBoxUsers often encounter the problem of being unable to access wireless networks. This occurs because the virtual machine, by default, uses an emulated network card, which connects to the internet through the host's cable connection, ignoring the physical WiFi adapter.

To audit wireless networks or simply access the internet via Wi-Fi, you need to pass a physical USB device inside the guest system. This process requires installing additional extension packages and properly configuring the USB controller. Without these steps, Kali Linux will only see a virtual Ethernet cable, making it impossible to intercept packets or scan the airspace.

In this guide, we will go through all the setup steps, starting from installation Extension Pack and ending with checking the interface's operation in monitoring mode. You'll learn how to avoid common access rights and driver errors that often block the adapter from working in a virtual environment.

Preparing the host and installing VirtualBox extensions

The first critical step is to install the extension pack Oracle VM VirtualBox Extension PackThe standard version of the program does not contain proprietary drivers for USB 2.0 and USB 3.0, which are essential for wireless adapter forwarding. You must download the package version that strictly matches the version of your VirtualBox installation, otherwise the system will return a compatibility error.

After downloading a file with the extension .vbox-extpack, double-click it to launch it. The virtualization manager will prompt you to install the component, and you'll need to enter your administrator password to make changes to system files. The installation occurs in the background and takes only a few seconds.

⚠️ Important: The Extension Pack version must match the VirtualBox version down to the last character (e.g., 7.0.14 for 7.0.14). Using incompatible versions will cause the USB controller to fail.

Now you need to check that the USB controller is enabled for your virtual machine. Select Kali Linux from the list on the left, click the button Tune and go to the section Ports -> USBHere you should make sure that the “Enable USB controller” box is checked and the controller type is selected. USB 3.0 (xHCI) for maximum compatibility with modern adapters.

☑️ Checking VirtualBox readiness

Completed: 0 / 4

Setting up a USB filter for a wireless adapter

The most important step is creating a rule that will force the host system to release the WiFi adapter and transfer control to the Kali Linux virtual machine. In the same USB settings window, click the add new filter icon (the green plus sign on the right). Select your wireless adapter from the list that appears. If it's not listed, check the connection and drivers on the host system.

After selecting a device, a new line with the adapter's name will appear in the list. This means that once you start the virtual machine, the host will automatically disconnect from this device, making it accessible within Kali. On the host system (Windows or macOS), the WiFi icon may disappear or change its status to "Disconnected"—this is normal.

Start the virtual machine. Once Kali Linux boots, open a terminal and enter the command lsusbIn the output, you should see a line with the name of your adapter (for example, Realtek, Ralink or Atheros). If the device is displayed, then the forwarding was successful.

Installing drivers in the guest system

Even if the device is successfully forwarded, the adapter may not work immediately if the distribution Kali Linux The necessary firmware files are missing. Many modern adapters, especially those with chips Realtek RTL8812AU or MediaTek, require the installation of proprietary drivers separately from the kernel.

First, update the repositories and check the available packages. Enter the following command in the terminal to update the package lists:

sudo apt update && sudo apt upgrade -y

It's often necessary to install kernel header and compiler packages if the driver needs to be built manually. Ensure you have internet access via a virtual network address (NAT) to download the necessary components. Enter the following sequence of commands:

sudo apt install -y linux-headers-$(uname -r) build-essential git dkms

⚠️ Note: Network card interfaces may change their names (e.g., from wlan0 to wlan1) after a reboot or USB configuration change. Always check the current interface name with the command ip link.

If your adapter requires specific drivers, they can often be found in the repository. kali-linux-headers or on the chipset developers' GitHub. There's no universal solution for all chips, as support depends on the specific vendor and kernel version. Linux.

Checking the interface operation and monitoring mode

After installing the drivers, you need to make sure the network interface is active. In Kali Linux, a utility is often used to manage wireless connections. airmon-ng from the package aircrack-ngRun the interface check:

sudo airmon-ng

In the table, you will see a list of available interfaces. Your WiFi adapter should be displayed in the "Interface" column. If a driver is listed next to the interface name in the "Driver" column (e.g., rtl8812au), and in the “PHY” column the number is indicated, which means the system sees the device correctly.

To test traffic interception, try enabling monitoring mode. This is a key feature for a penetration tester. Run the command:

sudo airmon-ng start wlan0

If the command is successful, you will see a message that a new interface has been created, usually called wlan0monThe presence of the "mon" suffix confirms that the adapter has switched to listening mode for the entire airspace, ignoring associations with access points.

Troubleshooting Realtek and MediaTek Drivers

The most common problems occur with chip-based adapters RealtekStandard drivers in the Linux kernel may be unstable or not support monitor mode. In such cases, it is recommended to use community-provided drivers, such as the project lwfinger on GitHub.

The installation process involves cloning the repository and compiling the module. This requires careful attention, as any syntax error will cause the build to fail. Below is a rough outline of the steps for popular chips:

  • 📡 Find the exact chip model using the command lsusb and look for the corresponding driver on GitHub.
  • 💻 Clone the repository: git clone repository_url.
  • 🔨 Go to the folder and run the installation: make && sudo make install.
  • 🔄 Reboot the virtual machine to apply the changes.

Sometimes, after updating the Kali Linux kernel, drivers stop working because the modules were compiled for an older kernel version. In this case, the compilation process must be repeated. Using the DKMS (Dynamic Kernel Module Support) manager can automate this process, but requires proper initial setup.

Comparison of connection methods and compatibility table

There are several ways to set up a virtual machine network, but only one is suitable for security purposes. Understanding the differences between VirtualBox networking modes will help avoid confusion in the future.

Network mode Internet access Monitoring mode Usage
NAT Eat No Updating the system, downloading packages
Network Bridge Eat No (without USB) Scanning the host's network, but not WiFi
USB Passthrough Depends on the adapter Yes WiFi auditing, packet injection
Internal network No No Isolated laboratory networks

As can be seen from the table, the mode USB Passthrough is the only option for fully utilizing the wireless spectrum. Bridged mode is often confused with direct WiFi access, but in reality, it simply forwards the virtual machine's MAC address to the host's wired network.

For stable operation, we recommend having two adapters: one built-in for internet access through NAT, and a second external USB adapter for attacks and analysis. This configuration allows you to remain online during testing.

Frequently Asked Questions (FAQ)

Why doesn't Kali Linux detect my WiFi adapter after USB forwarding?

Most likely, the system does not have drivers for this model. Check the command output. dmesg | tail Immediately after connecting the device. If you see messages about firmware loading errors, you need to find and install the appropriate driver package for your chipset.

Is it possible to use a laptop's built-in WiFi for Kali in VirtualBox?

Technically, it's possible if the virtual machine captures the device through a USB filter. However, many built-in adapters don't support monitoring mode well or have power limitations. For professional work, it's better to use an external USB adapter.

How do I regain control of my WiFi adapter on Windows?

Simply disable the USB filter in the virtual machine settings or shut down the virtual machine itself. VirtualBox will automatically return the device to the host system. If this doesn't happen, physically reconnect the USB device.

Do you need a static IP for WiFi to work in Kali?

No, an IP address is not required to operate in monitoring or client mode. However, to access the internet, you will need to configure DHCP or assign a static address, depending on your network configuration.