Where this falls
Why a pentester learns the plumbing
Most of the time you drive a wireless card through a friendly tool and never think about what sits beneath it. Then comes the engagement that breaks that comfort: a remote wireless test, where a sysadmin has plugged a card into a box on-site and handed you nothing but SSH.
Normally you drive an automatic car and never open the hood. A remote wireless test is being dropped into an unfamiliar car, in the dark, over the phone. If the engine won't start you can't call roadside assistance. You have to know where the battery, the fuses and the starter are yourself. These tools are the fuse box.
You don't get to choose the hardware. The card might be one you've never touched, the driver might misbehave, and your only way to diagnose and fix it is the command-line toolkit in this module. Three things to walk away able to do:
- Identify any card's chipset and driver from scratch.
- Load, unload and reload drivers when they fight or hang.
- Put a card into monitor mode by hand with
iw, no helper scripts.
airmon-ng are just wrappers over the commands here. When the wrapper fails on strange hardware, this is what you fall back to. Knowing the layer underneath is the difference between "the card doesn't work" and "the card works now."
01 · Identify & load
Loading and unloading drivers
When you plug a card in, Linux usually loads the right driver automatically. Your first job is to find out which driver and which chipset you're dealing with.
Step 1 — what driver claimed my card?
$ sudo airmon-ng PHY Interface Driver Chipset phy0 wlan0 ath9k_htc Qualcomm Atheros AR9271 802.11n
Driver = ath9k_htc, chipset = Atheros AR9271. Confirm the raw USB identity with lsusb:
$ sudo lsusb Bus 001 Device 002: ID 0cf3:9271 Qualcomm Atheros AR9271 802.11n # 0cf3 = vendor id (Qualcomm Atheros), 9271 = product id (AR9271)
On Windows every device needs its own installed driver. On Linux, one driver can cover 50+ devices that share a chipset. The Alfa AWUS036NHA, the TP-Link WN722N v1, and dozens more all ride on ath9k_htc — and because it ships in the kernel, there's nothing to install.
Step 2 — inspect the driver with modinfo
Most drivers are Loadable Kernel Modules (LKM): loaded only when needed to save memory. modinfo reveals a driver's file path, firmware, dependencies and tunable parameters.
$ sudo modinfo ath9k_htc filename: /lib/modules/<kernel>/.../ath9k_htc.ko firmware: ath9k_htc/htc_9271-1.4.0.fw depends: mac80211,ath9k_hw,ath9k_common,ath,cfg80211,usbcore alias: usb:v0CF3p9271d*... # matches vendor/product id vermagic: 4.16.0-kali2-amd64 SMP parm: blink:Enable LED blink on activity (int)
- filename — where the
.kolives:/lib/modules/<kernel version>. - firmware — firmware blobs the driver loads onto the card.
- alias — the
usb:v0CF3p9271pattern is how the kernel matches card → driver. - depends — modules auto-loaded alongside it (the tree in the next section).
- parm — tunable options you can set at load time.
Step 3 — load with a parameter
modprobe loads a module from the kernel directory and pulls in its dependencies. Here we disable the activity LED (handy when you don't want a blinking card giving you away):
$ sudo modprobe ath9k_htc blink=0 # no output = success. Errors print to console.
/etc/modprobe.d/.
modprobe vs insmod
| Command | Loads from | Handles dependencies? | Use when |
|---|---|---|---|
| modprobe | kernel modules dir | yes, automatic | Normal loading |
| insmod | a specific file path | no | Testing a driver you compiled, e.g. insmod rtl8812au.ko |
02 · The module tree
The dependency tree
A wireless driver never loads alone. It sits on top of a stack of helper modules, and lsmod shows the whole pile with a "used by" count. To unload cleanly you reverse the tree: dependents first, foundation last.
Figure 1 — Load order flows top → bottom. Unload order is bottom → top.
$ lsmod Module Size Used by ath9k_htc 81920 0 ath9k_common 20480 1 ath9k_htc ath9k_hw 487424 2 ath9k_htc,ath9k_common ath 32768 3 ath9k_htc,ath9k_hw,ath9k_common mac80211 802816 1 ath9k_htc cfg80211 737280 4 ath9k_htc,mac80211,ath,ath9k_common # col 3 = how many (and which) modules depend on this one
Unloading in the right order
Try to pull a foundation module while something still needs it and the kernel refuses:
$ sudo rmmod ath rmmod: ERROR: Module ath is in use by: ath9k_htc ath9k_hw ath9k_common
Remove the dependents first, foundation last (left to right = top of tree to bottom):
$ sudo rmmod ath9k_htc ath9k_common ath9k_hw ath # unsure what's safe to remove next? run lsmod again, # pick any module with a used-by count of 0
03 · The old guard
Legacy tools: iwconfig & friends
These date from the early 2000s and the old ieee80211 framework. They still work through a compatibility layer, but they're deprecated and limited. Know them so you recognise them in old guides; reach for iw in practice.
| Tool | Does what |
|---|---|
| iwconfig | Basic params: change mode, set channel, set keys |
| iwlist | Start scans, list frequencies, bit rates, encryption |
| iwspy | Per-node link quality (rarely implemented by drivers) |
| iwpriv | Driver-specific Wireless Extensions tweaks |
$ sudo iwlist wlan0 frequency wlan0 14 channels in total; available frequencies: Channel 01 : 2.412 GHz Channel 06 : 2.437 GHz Channel 11 : 2.462 GHz ... # output varies by geography (regulatory domain)
iwconfig wlan0 mode monitor, you're reading an old tutorial. The modern equivalent lives in the next section.
04 · One utility to rule them all
The iw utility
iw is built for the modern mac80211 framework and replaces the entire legacy set. Its syntax looks dense but follows one simple shape: what device → what to do → with what options.
iw list — the card's full capability sheet
Before an engagement, this tells you what the card can and can't do: which modes it supports and which frequencies are legal.
$ sudo iw list Wiphy phy0 Supported interface modes: * managed # normal client * AP # act as an access point * monitor # capture raw frames ← what we want * mesh point / IBSS / P2P ... Frequencies: * 2412 MHz [1] (20.0 dBm) * 2462 MHz [11] (20.0 dBm) * 2484 MHz [14] (disabled) # forbidden here
monitor appear under "Supported interface modes"? No monitor = no capture = that card is useless for most of OSWP. This one command saves you an hour of fighting a card that was never going to work.
Scanning for networks and their channels
The channel a target sits on is critical — you tune your capture to it. Filter the scan to just SSIDs and channels:
$ sudo iw dev wlan0 scan | egrep "DS Parameter set|SSID:" SSID: wifu DS Parameter set: channel 3 SSID: 6F36E6 DS Parameter set: channel 11
05 · The core skill
Monitor mode, step by step
This is the manual version of what airmon-ng start does for you. Four commands: create a virtual monitor interface, bring it up, verify it, and (later) tear it down.
sudo iw dev wlan0 interface add wlan0mon type monitorsudo ip link set wlan0mon upsudo iw dev wlan0mon infosudo tcpdump -i wlan0monsudo iw dev wlan0mon interface delA normal (managed) interface is a phone that only shows calls meant for you. Monitor mode is a police scanner — it picks up every transmission in the air regardless of who it was addressed to. A Virtual Interface (VIF) lets you run that scanner alongside the normal interface on the same physical card.
$ sudo iw dev wlan0mon info Interface wlan0mon addr 0c:0c:ac:ab:a9:08 type monitor channel 11 (2462 MHz), width: 20 MHz
$ sudo tcpdump -i wlan0mon listening on wlan0mon, link-type IEEE802_11_RADIO 13:39:17 ... 2412 MHz 11b -20dB signal Beacon (wifu) ESS CH: 3, PRIVACY # Ctrl+C to stop. A beacon = monitor mode is working.
interface del, running info on it returns No such device (-19). That error is confirmation the VIF is gone, not a failure.
06 · Playing by the rules
Regulatory domains & CRDA
Wireless law differs by country: which channels are legal, how much power you may transmit, whether radar-avoidance (DFS) applies. The Central Regulatory Domain Agent (CRDA) enforces the rules for your location, and iw reg queries or changes them.
$ sudo iw reg get global country 00: DFS-UNSET # Kali's default = world domain $ sudo iw reg set US # 2-letter ISO code; no output = success # in-memory only! persist it in /etc/default/crda → REGDOMAIN=US
The regulatory domain is a speed-limit sign the card obeys. Set it to a stricter country and channels vanish; set it to a looser one and more appear — but the card still obeys the most restrictive rule that applies. On a 2.4 GHz card, US unlocks only channels 1–11, while GB would allow 12 and 13.
disabled in iw list even when GB would allow them.
07 · The kill switch
rfkill
Sometimes the card is fine but the radio is simply switched off. rfkill enables and disables radios — Wi-Fi, Bluetooth, LTE, GPS, NFC, anything. If a card shows up in lsmod but refuses to transmit, check here first.
Set by rfkill itself (or another app). You can clear it with unblock.
A physical switch or BIOS setting. rfkill cannot clear this — flip the switch.
$ sudo rfkill list 0: hci0: Bluetooth Soft blocked: no Hard blocked: no 1: phy0: Wireless LAN Soft blocked: no Hard blocked: no $ sudo rfkill block 1 # disable device #1 (Wi-Fi) $ sudo rfkill unblock 1 # re-enable it $ sudo rfkill block all # kill every radio $ sudo rfkill unblock all # bring them all back
rfkill list. A Soft blocked: yes is a one-command fix. A Hard blocked: yes means go find the physical switch.
08 · Two generations
The two wireless stacks
Linux has had two wireless subsystems. The old one explains why older tools and tutorials look the way they do; the new one is what everything modern is built on.
| ieee80211 / wext | mac80211 | |
|---|---|---|
| Era | early Wi-Fi → ~802.11g/n | modern, all current kernels |
| Tools | iwconfig, iwlist, iwpriv | iw |
| Common code | each driver reimplemented it | centralised in the framework |
| Interface names | inconsistent (eth, ath, wifi…) | wlan* / wlp* / wlx* |
| WPA / master mode | often unsupported | wpa_supplicant / hostapd |
| Status | deprecated | standard |
09 · The modern stack
mac80211, cfg80211 & nl80211
mac80211 doesn't work alone — it's part of a small family of libraries that carry a command from your terminal down to the card's radio. Here's the path a request takes.
Figure 2 — SoftMAC drivers route through mac80211; FullMAC drivers talk to cfg80211 directly.
The messenger. Lets tools (iw, wpa_supplicant, aircrack-ng) talk to drivers via cfg80211.
The 802.11 configuration API. Talks to FullMAC directly, to SoftMAC through mac80211, and enforces CRDA.
Implements the wireless functions SoftMAC radios need. Where shared bug fixes and features live.
10 · Where the logic lives
FullMAC vs SoftMAC
The split is about where the Wi-Fi brain sits — in the card's own firmware, or in the Linux driver. It decides how the card behaves and who ships its bug fixes.
Both revolve around the MLME (MAC Sublayer Management Entity), which handles the management operations: authentication, deauthentication, association, disassociation, reassociation, and beaconing.
| FullMAC | SoftMAC | |
|---|---|---|
| MLME runs in | card firmware / hardware | the driver software (mac80211) |
| Driver size | minimal | complex |
| Typical use | phones, low-power / mobile | laptops, USB adapters |
| Example | brcmfmac (Broadcom) | iwlwifi (Intel) |
| Power use | lower | higher |
| Who ships fixes | the vendor | the kernel (everyone at once) |
FullMAC is a car with a sealed automatic gearbox — efficient, but you depend on the manufacturer to fix anything inside it. SoftMAC is a manual gearbox exposed to the mechanic — more work, but any improvement to the shared toolkit (mac80211) upgrades every car at once. For a pentester, SoftMAC's openness is usually the friendlier ground.
11 · Keep this open
Command cheat sheet
# ---- IDENTIFY ---- $ sudo airmon-ng # driver + chipset $ sudo lsusb # vendor:product id $ sudo modinfo ath9k_htc # deps, firmware, params $ lsmod # loaded modules + used-by # ---- LOAD / UNLOAD ---- $ sudo modprobe ath9k_htc # load (+deps) $ sudo modprobe ath9k_htc blink=0 $ sudo rmmod ath9k_htc ath9k_common ath9k_hw ath $ sudo insmod ./rtl8812au.ko # load from a path # ---- INSPECT CARD ---- $ sudo iw list # modes + frequencies $ sudo iw dev wlan0 scan | egrep "DS Parameter set|SSID:" # ---- MONITOR MODE (manual) ---- $ sudo iw dev wlan0 interface add wlan0mon type monitor $ sudo ip link set wlan0mon up $ sudo iw dev wlan0mon info $ sudo tcpdump -i wlan0mon $ sudo iw dev wlan0mon interface del # ---- REGULATORY ---- $ sudo iw reg get $ sudo iw reg set US # ---- RADIO KILL SWITCH ---- $ sudo rfkill list $ sudo rfkill unblock 1 # clear soft block
rfkill list (radio off?), iw list (monitor supported?), lsmod (driver loaded?), iw reg get (channels blocked?). Those four answers explain almost every "my card doesn't work" on a remote test.