Skip to content

hostapd

60 commands

A user-space daemon that turns a wireless card into an access point — used for test networks and rogue-AP assessments.

  • Wi-Fi
  • access point

Install hostapd

sudo apt install hostapd

Basic Access Point Startup5

hostapd -h

Displays the help message with all available command-line options and syntax

hostapd -v

Prints the current version of hostapd to verify installation and build details

hostapd hostapd.conf

Starts the access point in the foreground using a specific configuration file

Link
hostapd -B hostapd.conf

Starts hostapd in daemon mode (background) to run as a service

Link
hostapd -P /run/hostapd.pid -B hostapd.conf

Runs in background and writes the process ID to a specific file for service management

Link

Logging and Debugging5

hostapd -d hostapd.conf

Starts hostapd with verbose debugging enabled to show basic status and event messages

hostapd -dd hostapd.conf

Enables excessive debugging to view detailed state machine transitions and frame details

hostapd -t -d hostapd.conf

Prepends timestamps to all debug output for timeline analysis of connection events

hostapd -f /var/log/hostapd.log hostapd.conf

Redirects all log output to a specified file instead of standard output

hostapd -K -dd hostapd.conf

Includes cryptographic key data in debug output (Warning: Unsafe for production, used for deep inspection)

Link

Configuration File Handling1

hostapd -g /var/run/hostapd/global hostapd.conf

Enables the global control interface for external management tools like hostapd_cli

Link

Open Network Workflow1

printf 'interface=wlan0\ndriver=nl80211\nssid=OpenLab\nhw_mode=g\nchannel=6\n' > hostapd.conf && hostapd hostapd.conf

Creates and runs a basic Open (unencrypted) 2.4GHz access point on channel 6

Link

Interface Management1

printf 'interface=wlan0\nbridge=br0\nssid=BridgedAP\nhw_mode=g\nchannel=1\n' > hostapd.conf && hostapd hostapd.conf

Configures the AP to bridge traffic to a wired interface (br0) for network integration

Link

SSID and Visibility1

printf 'interface=wlan0\nssid=HiddenLab\nignore_broadcast_ssid=1\nhw_mode=g\nchannel=11\n' > hostapd.conf && hostapd hostapd.conf

Creates an access point with a hidden SSID by disabling beacon SSID broadcasting

Link

WPA2-PSK Configuration1

printf 'interface=wlan0\nssid=WPA2-Test\nhw_mode=g\nchannel=6\nwpa=2\nwpa_passphrase=Password123\nwpa_key_mgmt=WPA-PSK\nwpa_pairwise=CCMP\n' > hostapd.conf && hostapd hostapd.conf

Sets up a standard WPA2 Personal network using CCMP (AES) encryption

Link

WPA Mixed Mode Configuration1

printf 'interface=wlan0\nssid=LegacyMix\nwpa=3\nwpa_passphrase=LegacyPass\nwpa_key_mgmt=WPA-PSK\nwpa_pairwise=TKIP CCMP\n' > hostapd.conf && hostapd hostapd.conf

Enables mixed WPA1/WPA2 mode allowing both TKIP and CCMP ciphers (Legacy support)

Link

Access Control (MAC Filtering)2

printf 'interface=wlan0\nssid=MacFilterAP\nmacaddr_acl=1\naccept_mac_file=hostapd.accept\n' > hostapd.conf && echo '00:11:22:33:44:55' > hostapd.accept && hostapd hostapd.conf

Configures an Allow List (Whitelist) where only specified MAC addresses can associate

Link
printf 'interface=wlan0\nssid=DenyListAP\nmacaddr_acl=0\ndeny_mac_file=hostapd.deny\n' > hostapd.conf && echo 'aa:bb:cc:dd:ee:ff' > hostapd.deny && hostapd hostapd.conf

Configures a Deny List (Blacklist) to explicitly block specific devices from connecting

Link

Performance Tuning (802.11n)1

printf 'interface=wlan0\nssid=N-Mode-AP\nhw_mode=g\nchannel=6\nieee80211n=1\nht_capab=[HT40+]\n' > hostapd.conf && hostapd hostapd.conf

Enables 802.11n High Throughput mode with 40MHz channel width

Link

Performance Tuning (802.11ac)1

printf 'interface=wlan0\nssid=AC-Mode-AP\nhw_mode=a\nchannel=36\nieee80211n=1\nieee80211ac=1\nvht_oper_chwidth=1\nvht_oper_centr_freq_seg0_idx=42\n' > hostapd.conf && hostapd hostapd.conf

Enables 802.11ac Very High Throughput mode on 5GHz with 80MHz channel width

Link

Performance Tuning (802.11ax)1

printf 'interface=wlan0\nssid=AX-WiFi6\nhw_mode=a\nchannel=36\nieee80211n=1\nieee80211ac=1\nieee80211ax=1\nhe_su_beamformer=1\nhe_su_beamformee=1\n' > hostapd.conf && hostapd hostapd.conf

Enables 802.11ax (Wi-Fi 6) High Efficiency features including beamforming support

Link

Country and Regulatory1

printf 'interface=wlan0\nssid=RegDomainTest\ncountry_code=US\nieee80211d=1\n' > hostapd.conf && hostapd hostapd.conf

Advertises the US country code (802.11d) to clients to enforce regulatory domain constraints

Link

WPA3-SAE Configuration1

printf 'interface=wlan0\nssid=WPA3-SAE\nhw_mode=g\nchannel=6\nwpa=2\nwpa_passphrase=SecurePass123\nwpa_key_mgmt=SAE\nieee80211w=2\n' > hostapd.conf && hostapd hostapd.conf

Configures a pure WPA3 network using SAE authentication and mandatory Management Frame Protection (MFP)

Link

WPA3 Transition Mode1

printf 'interface=wlan0\nssid=WPA3-Transition\nhw_mode=g\nchannel=6\nwpa=2\nwpa_passphrase=TransitionPass\nwpa_key_mgmt=WPA-PSK SAE\nieee80211w=1\n' > hostapd.conf && hostapd hostapd.conf

Allows both WPA3-SAE and WPA2-PSK clients to connect with optional MFP

Link

OWE (Enhanced Open)1

printf 'interface=wlan0\nssid=OWE-Net\nhw_mode=g\nchannel=6\nwpa=2\nwpa_key_mgmt=OWE\nieee80211w=2\n' > hostapd.conf && hostapd hostapd.conf

Sets up Opportunistic Wireless Encryption (Enhanced Open) for encrypted unauthenticated connections

Link

WPA2-Enterprise (EAP-TLS/PEAP)1

printf 'interface=wlan0\nssid=Enterprise-AP\nwpa=2\nwpa_key_mgmt=WPA-EAP\nieee8021x=1\nauth_server_addr=127.0.0.1\nauth_server_port=1812\nauth_server_shared_secret=radiusSecret\n' > hostapd.conf && hostapd hostapd.conf

Configures WPA2-Enterprise requiring an external RADIUS server for 802.1X authentication

Link

Integrated EAP Server1

printf 'interface=wlan0\nssid=LocalEAP\nieee8021x=1\neap_server=1\neap_user_file=hostapd.eap_user\nca_cert=ca.pem\nserver_cert=server.pem\nprivate_key=server.key\n' > hostapd.conf && hostapd hostapd.conf

Uses hostapd's built-in EAP server to handle 802.1X authentication without an external RADIUS

Link

RADIUS Accounting1

printf 'interface=wlan0\nssid=AcctAP\nwpa=2\nwpa_key_mgmt=WPA-EAP\nieee8021x=1\nacct_server_addr=127.0.0.1\nacct_server_port=1813\nacct_server_shared_secret=radiusSecret\n' > hostapd.conf && hostapd hostapd.conf

Enables RADIUS accounting to report session duration and data usage to an accounting server

Link

Client Isolation1

printf 'interface=wlan0\nssid=IsolatedGuests\nap_isolate=1\nhw_mode=g\nchannel=6\n' > hostapd.conf && hostapd hostapd.conf

Prevents associated wireless clients from communicating directly with each other (Client Isolation)

Link

WPS Configuration1

printf 'interface=wlan0\nssid=WPS-Enabled\nwps_state=2\neap_server=1\nconfig_methods=label display push_button keypad\n' > hostapd.conf && hostapd hostapd.conf

Enables Wi-Fi Protected Setup (WPS) with Push Button and PIN methods (insecure but useful for testing)

Link

Multiple BSSID (Virtual APs)1

printf 'interface=wlan0\nssid=PrimaryNet\nbss=wlan0_1\nssid=GuestNet\nwpa=2\nwpa_passphrase=GuestPass\n' > hostapd.conf && hostapd hostapd.conf

Creates multiple virtual access points (SSIDs) on a single physical wireless interface

Link

Beacon Interval Tuning1

printf 'interface=wlan0\nssid=FastBeacon\nbeacon_int=15\nhw_mode=g\nchannel=6\n' > hostapd.conf && hostapd hostapd.conf

Reduces the beacon interval to 15 TU (approx 15ms) for aggressive network advertising

Link

Red Team Simulation (Karma/Mana)1

hostapd_cli -i wlan0 karma_enable

Enables Karma mode (if using a patched hostapd-mana) to respond to all probe requests

Link

Red Team Simulation (Rogue AP)1

printf 'interface=wlan0\nssid=CorporateWifi\nwpa=2\nwpa_passphrase=password123\nlogger_stdout=-1\nlogger_stdout_level=0\n' > rogue.conf && hostapd -K rogue.conf

Sets up a Rogue AP mimicking a corporate network and logging full details including keys for interception

Link

Blue Team Defense (Management Frame Protection)1

printf 'interface=wlan0\nssid=MFP-Strict\nwpa=2\nieee80211w=2\n' > hostapd.conf && hostapd hostapd.conf

Enforces Management Frame Protection (PMF) to block deauthentication attacks

Link

Purple Team Validation (VLAN Tagging)1

printf 'interface=wlan0\nssid=VLAN-AP\ndynamic_vlan=1\nvlan_file=hostapd.vlan\n' > hostapd.conf && hostapd hostapd.conf

Configures dynamic VLAN assignment based on RADIUS attributes or station MAC addresses

Link

Runtime Control10

hostapd_cli -p /var/run/hostapd ping

Pings the running hostapd daemon to verify the control interface is responsive

Link
hostapd_cli all_sta

Lists all currently associated stations (clients) along with their statistics

Link
hostapd_cli deauthenticate 00:11:22:33:44:55

Forces a specific client to disconnect from the access point immediately

Link
hostapd_cli disassociate 00:11:22:33:44:55

Disassociates a client, effectively kicking them off but allowing immediate reconnection attempts

Link
hostapd_cli set deny_mac_file hostapd.new_deny

Dynamically updates the path to the MAC deny list file without restarting the AP

Link
hostapd_cli reload

Reloads the configuration file to apply changes like updated MAC lists

Link
hostapd_cli wps_pbc

Activates WPS Push Button Configuration mode for the next two minutes

Link
hostapd_cli wps_pin any 12345670

Registers a specific WPS PIN to allow a client to connect using that PIN

Link
hostapd_cli get_config

Retrieves and displays the current runtime configuration details of the AP

Link
hostapd_cli log_level DEBUG

Dynamically changes the logging verbosity to DEBUG while the AP is running

Link

Advanced Troubleshooting2

hostapd -t -K -f /tmp/hostapd_debug.log hostapd.conf

Runs hostapd logging keys and timestamps to a file for offline packet decryption analysis

Link
hostapd_cli sta 00:11:22:33:44:55

Shows detailed statistics for a single connected client including signal strength and packet counts

Link

Hotspot 2.0 (Passpoint)1

printf 'interface=wlan0\nssid=PasspointAP\ninterworking=1\naccess_network_type=0\ninternet=1\n' > hostapd.conf && hostapd hostapd.conf

Enables Interworking bits to advertise Hotspot 2.0 capabilities to compatible clients

Link

Channel Switch Announcement1

hostapd_cli chan_switch 5 5180

Initiates a Channel Switch Announcement (CSA) moving the AP to a new frequency after 5 beacons

Link

Airtime Fairness1

printf 'interface=wlan0\nssid=FairAP\nwsmm_ac_vo_aifs=2\nwsmm_ac_vi_aifs=2\n' > hostapd.conf && hostapd hostapd.conf

Tunes WMM parameters (AIFS) to prioritize Voice/Video traffic or enforce airtime fairness

Link

Incident Response Simulation1

printf 'interface=wlan0\nssid=ForensicHoneypot\nwpa=2\nwpa_passphrase=honeyhoney\nlogger_syslog=1\nlogger_syslog_level=0\n' > hostapd.conf && hostapd hostapd.conf

Deploys a honeypot AP that logs all events to syslog for SIEM ingestion and incident simulation

Link

Dynamic Frequency Selection (DFS)1

printf 'interface=wlan0\nssid=DFS-Test\nhw_mode=a\nchannel=52\nieee80211h=1\n' > hostapd.conf && hostapd hostapd.conf

Configures the AP on a DFS channel (52) requiring radar detection (802.11h) enabled

Link

Fast BSS Transition (802.11r)1

printf 'interface=wlan0\nssid=RoamingAP\nwpa=2\nwpa_passphrase=roamingpass\nieee80211r=1\nmobility_domain=a1b2\n' > hostapd.conf && hostapd hostapd.conf

Enables Fast Transition (FT) to allow clients to roam quickly between APs in the same mobility domain

Link

Protection Mechanisms1

printf 'interface=wlan0\nssid=ProtMode\nhw_mode=g\nchannel=6\nrts_threshold=2347\nfragm_threshold=2346\n' > hostapd.conf && hostapd hostapd.conf

Adjusts RTS and Fragmentation thresholds to manage collisions in noisy environments

Link

Client Load Balancing1

printf 'interface=wlan0\nssid=LoadBalanceAP\nmax_num_sta=10\n' > hostapd.conf && hostapd hostapd.conf

Limits the maximum number of associated stations to 10 to force load balancing to other APs

Link

Automation Workflow1

hostapd -B hostapd.conf && sleep 5 && hostapd_cli ping && echo 'AP Started'

Automation sequence to start hostapd, wait for initialization, and verify responsiveness

Link

Cleanup3

killall hostapd

Stops all running hostapd instances immediately

Link
rm -f /var/run/hostapd/*

Cleans up stale control interface sockets to prevent binding errors on restart

Link
ip link set wlan0 down && ip addr flush dev wlan0

Resets the wireless interface state to default after stopping the access point

Link