Setting up a WiFi adapter in Kali Linux: From drivers to injections

Working with wireless networks in the environment Kali Linux is a fundamental task for any information security specialist. Unlike standard Linux distributions, the connection process here can be fraught with a number of technical difficulties, requiring a deep understanding of the driver architecture and the system kernel. Wireless Adapters in this context are considered not just as a means of accessing the Internet, but as a powerful tool for security auditing.

Initial configuration often hampers the lack of pre-installed proprietary drivers or the need to configure the card for specific operating modes. Beginners often encounter problems with the interface simply not displaying or operating unstable. This occurs because network stack Linux requires fine-tuning to interact with a variety of hardware. Understanding these processes is critical to successful implementation. pentests.

In this article, we'll cover every step in detail: from selecting compatible hardware to complex command line manipulation. You'll learn how to turn an ordinary USB dongle into a professional traffic analysis tool. Manual tuning skills will allow you to work even in the most non-standard situations, when automatic utilities are powerless.

Selecting compatible hardware and testing the adapter

The success of the entire operation directly depends on the chosen WiFi adapterNot every device supports the features required by Kali Linux, such as Monitor Mode (monitoring mode) and Packet Injection (packet injection). Most integrated laptop cards based on Intel or Broadcom chips have limited security functionality, operating only in client mode.

For professional use, we recommend using external USB adapters based on the Atheros AR9271, Ralink RT3070, or Realtek RTL8812AU chipsets. These models have open documentation and are well supported by the community. Always check the device's specifications for injection support before purchasing, as this is a potential issue. key requirement to conduct penetration tests on wireless networks.

After connecting the device to the USB port, you need to make sure the system has identified it correctly. Use the command lsusb to view a list of connected USB devices. You should see the name of your adapter and vendor in the output. If the device is displayed but doesn't work, the problem is most likely due to missing drivers.

⚠️ Please note: Some modern adapters that support the WiFi 6 (802.11ax) standard may require drivers to be compiled from source code, making setup more difficult for novice users.
📊 What chipset does your WiFi adapter have?
Atheros AR9271
Realtek RTL8812AU
Ralink RT3070
MediaTek MT7921
I don't know / Built-in

For more detailed information about network interfaces, use the utility ip link or outdated but informative ifconfig -a. These commands will show the interface status: whether it is up (UP) or omitted (DOWNIf the interface is not listed, the system does not see the device at the kernel level, which requires the installation of additional firmware packages.

Installing and updating drivers in Kali

In modern versions of the Kali Linux distribution, the driver installation process is significantly simplified thanks to repositories. However, for specific chipsets, such as Realtek, manual installation is often required. The first step should always be updating package lists and installing the kernel headers needed to compile modules.

sudo apt update

sudo apt install -y linux-headers-$(uname -r)

If your adapter requires proprietary firmware files, install the package firmware-realtek or firmware-atheros Depending on the model. After installing the files, you must reboot the system or restart the network interface service for the changes to take effect. It often happens that the driver is installed, but the kernel module is not loaded automatically.

☑️ Checking driver installation

Completed: 0 / 4

You can check loaded kernel modules using the command lsmod | grep -i wifi or by driver name. If the module is missing, try loading it manually with the command modprobeIf you encounter errors when compiling DKMS (Dynamic Kernel Module Support), carefully examine the terminal output—often the problem lies in the absence of a compiler. gcc or utilities make.

Realtek 8812au series adapters, popular among pentesters, often require cloning the GitHub repository and manually building them. This ensures support for monitoring mode, which can be disabled in standard drivers. The build process takes several minutes and requires a stable internet connection.

WiFi interface operating modes: Managed and Monitor

Understanding the difference between wireless interface operating modes is critical. In standard mode Managed (Managed) The card behaves like a regular client: it scans networks, associates with an access point, and exchanges data exclusively with it. In this mode, most packets not addressed to your MAC address are ignored by the driver and discarded.

Mode Monitor (Monitoring) radically changes the adapter's behavior. In this mode, the card "listens" to the entire airwaves on the selected frequency, capturing all passing packets, regardless of who they're intended for. This allows you to analyze other users' traffic, search for vulnerabilities, and conduct security audits. Switching between modes is done through the utility. airmon-ng or iw.

To put an interface into monitoring mode, follow these steps. First, stop processes that may interfere with packet capture (NetworkManager, wpa_supplicant). Then, create a virtual monitoring interface. The interface name is usually changed by adding a suffix. mon, For example, wlan0mon.

sudo airmon-ng start wlan0

To use this feature, you'll need either a second WiFi adapter or a wired Ethernet connection. After testing, be sure to reset the interface to its original state using the command airmon-ng stop wlan0monto restore normal network operation.

Why does the Internet disappear when Monitor Mode is enabled?

Monitor mode forces the network card to ignore standard router association protocols. The card switches to passive listening mode, disconnecting the active connection to the access point. Simultaneous operation requires two physical cards or virtualization.

Diagnosing problems and troubleshooting errors

Setting up WiFi in Kali Linux rarely goes perfectly the first time. The most common issue is the interface not loading or crashing immediately after launching. airmon-ngThis is often due to a driver conflict or blocking system processes. Utility airmon-ng check helps identify processes that need to be completed before starting work.

Another common error is the message "Device or resource busy." This means that a process is already using the device. In such cases, restarting the network service or completely disconnecting and reconnecting the USB adapter helps. It's also worth checking the kernel logs using the command dmesg | tail immediately after connecting the device to see initialization errors.

If the adapter is unstable, overheats, or loses connection, it may not be receiving enough power. Using a USB hub without its own power source can cause problems, especially with high-power adapters with an external antenna. In such cases, it is recommended to use a powered USB hub or connect directly to the motherboard port.

Problem Possible cause Solution
Adapter not visible in lsusb Port or cable failure Check the connection, change the USB port
Unable to enable Monitor Mode The driver does not support the mode Replace the adapter with a compatible one (Atheros/Realtek)
The interface keeps crashing. Lack of nutrition or overheating Use a powered USB hub and check the cooling.
Errors when compiling drivers Missing kernel headers Install the linux-headers-$(uname -r) package

Using specialized utilities for auditing

After successfully configuring the adapter and putting it into monitoring mode, the next step is to use specialized software. The main tool is the package Aircrack-ng, which includes utilities for capturing handshakes, deauthenticating clients, and brute-forcing keys. Team airodump-ng Allows you to visualize surrounding networks and clients.

For deeper traffic analysis, it is often used Wireshark or KismetThese programs allow for detailed examination of packet contents if they are unencrypted, or for analyzing metadata. It is important to use these tools only for legitimate purposes, such as auditing your own networks or as part of a coordinated pentest.

Also worth mentioning is the utility mdk4, which allows for stress testing of networks. It can create channel load and test equipment resilience to various types of flood attacks. However, using such tools on other people's networks without permission is illegal.

⚠️ Warning: Using deauthentication tools and traffic interception on networks you don't own is illegal. All actions should be performed solely for educational purposes or on your own equipment.

FAQ: Frequently Asked Questions

Can I use my laptop's built-in WiFi for pentesting?

In most cases, integrated cards (especially Intel cards) only support client mode and are unable to perform packet injection. For full functionality in Kali Linux, an external USB adapter with Monitor Mode and Packet Injection support is required.

Why does the airmon-ng command give an "unrecognized option" error?

The syntax of the utilities may have changed in newer versions. Try using airmon-ng start wlan0 instead of the old options. Also make sure that the package aircrack-ng Fully updated via repository.

How do I return my WiFi to normal mode after testing?

Use the command sudo airmon-ng stop wlan0mon (or the name of your interface). If this doesn't help, rebooting the system is guaranteed to reset the driver settings to their default state.

Do you need root to use WiFi in Kali?

Yes, changing the interface state, enabling monitoring mode, and sending raw packets requires superuser privileges. All commands should be prefixed with sudo or from under root.