simpleap.sh spins up a 2.4 GHz WPA2 AP on Linux for mobile app/network testing. It’s built to be reliable on Kali in a VM with Realtek AU USB adapters (e.g. AWUS036ACS).
- Open WLAN → router by default (host services on
10.10.10.1:*and reach clients from the router). - DHCP/DNS via
dnsmasq, AP viahostapd. - NAT + port forwards via iptables (iptables-nft); explicit
INPUTrules so DHCP works even when the distro’sINPUTpolicy isDROP. - Transparent REDIRECT/DNAT helpers for Burp or other tooling.
- Non-destructive: unique
/tmprun dir, live logs, Ctrl-C reverts everything. - Compat mode for flaky AP drivers (disables 11n/WMM/PMF).
On current kernels (Kali ≥ 2025, kernel ≥ ~6.x, tested on 7.1.x): use the mainline
rtw88 driver. It is in-tree, needs no build, and supports AP mode natively.
The RTL8811/8812/8814AU chips used by the Alfa AWUS036AC / AWUS036ACS are now handled
by the kernel's rtw88 USB driver (rtw88_8812au, rtw88_8821au, rtw88_8814au).
Because rtw88 is a mac80211/cfg80211 driver, hostapd drives it directly — no
DKMS, no pinned commits.
The old out-of-tree aircrack-ng
rtl8812au@63cf0b4recipe (for Kali 2024) is obsolete and no longer compiles on modern kernels: they removed the deprecatedEXTRA_CFLAGS/EXTRA_LDFLAGSKbuild vars (nowccflags-y/ldflags-y), the legacy timer API (from_timer/del_timer*→timer_container_of/timer_delete*), and migrated manycfg80211_opsfromnet_devicetowireless_dev. Don't fight that — usertw88.
# 1) Update the OS (get the newest rtw88 from the kernel package)
sudo apt update && sudo apt full-upgrade -y
sudo reboot now# 2) Make sure nothing blacklists the in-tree driver
grep -rniE 'rtw88|rtl8xxxu' /etc/modprobe.d/ | grep -i blacklist # expect no output# 3) Load the driver (usually automatic on plug-in) and confirm the interface
sudo modprobe rtw88_8812au # RTL8812AU (AWUS036AC)
sudo modprobe rtw88_8821au # RTL8811AU (AWUS036ACS)
# plug the adapter in, then:
iw dev # should show wlanX# 4) Verify AP mode is supported
iw list | sed -n '/Supported interface modes:/,/Band 1/p' # must include "* AP"Notes
- If you previously installed an out-of-tree
8812au/realtek-rtl88xxau-dkms, remove anyblacklist rtw88/blacklist rtl8xxxulines it dropped in/etc/modprobe.d/, otherwise the in-tree driver can't bind.- A stale
dkms statusentry for8812authat only showsadded(never built) is harmless, but you can drop it:sudo dkms remove 8812au/<version> --all.rtw88is maintained with the kernel, so kernel upgrades don't require a rebuild.Only if
rtw88genuinely fails for your specific adapter, the interactive installer (--install) offers an out-of-tree DKMS fallback that clones current aircrack-ngmaster— note it may still need manual source patches on bleeding-edge kernels.
chmod +x simpleap.sh
# one-shot automatic setup: installs deps + the right driver for your kernel
sudo ./simpleap.sh --install
# Realtek/VM-friendly baseline: channel 1, compat mode, Burp on local :8080
sudo ./simpleap.sh wlan0 eth0 PentestAP StrongPass123 \
--channel 1 --mode compat \
--forward tcp:80=8080 \
--forward tcp:443=8080- SSID
PentestAPon 2.4 GHz ch 1. - Clients get
10.10.10.0/24; router is10.10.10.1. - HTTP/HTTPS from clients transparently redirected to local
:8080(Burp). Install Burp CA on devices if you intercept TLS.
Stop with Ctrl-C — rules and processes are removed.
Fully automatic, no prompts — run it once and it sets everything up:
sudo ./simpleap.sh --installWhat it does:
- Installs runtime packages (
hostapd dnsmasq iptables iproute2 iw tcpdump). - Verifies the required tools are present.
- Autodetects the running kernel and installs the appropriate Wi-Fi driver:
- Kernel with in-tree
rtw88AU support (Kali ≥ 2025 / kernel ≥ ~6.x, incl. the 7.x series): loads the mainlinertw88driver — no build. If an older out-of-tree install left ablacklist rtw88/rtl8xxxuline behind, it is neutralized automatically so the in-tree driver can bind. - Kernel without in-tree AU support (legacy): clones aircrack-ng
rtl8812au, applies modern-kernel compatibility patches (ccflags-y, timer-API shims, disables the bridge extension) and installs it via DKMS.
- Kernel with in-tree
- Reports the detected Wi-Fi interfaces and confirms AP-mode capability.
Because the driver decision is made from uname -r at run time, the same command
works across both installed kernels — boot either one and re-run --install
(the in-tree driver ships per-kernel; a DKMS driver auto-rebuilds per-kernel).
Installer output is structured and explicit ([STEP], [CMD], [OK], [INFO], [WARN], [DONE], [NEXT]).
If a run crashes or leaves partial state, use the built-in comprehensive cleanup:
sudo ./simpleap.sh --cleanupYou can target non-default interfaces/subnet:
sudo ./simpleap.sh --cleanup --wifi-if wlan1 --uplink-if eth1 --subnet 10.20.30.0/24What --cleanup does:
- Stops
hostapdanddnsmasq - Removes NAT PREROUTING REDIRECT/DNAT rules for the Wi-Fi interface
- Removes known INPUT/OUTPUT/FORWARD/MASQUERADE rules added by the script
- Flushes IP addresses on Wi-Fi interface, sets interface back to managed mode, sets it down
- Re-enables NetworkManager management for the Wi-Fi interface (if
nmcliis available) - Sets
net.ipv4.ip_forward=0
Output is structured and shows exact commands before execution.
sudo ./simpleap.sh WIFI_IF UPLINK_IF SSID WPA2_PSK \
[--channel 1] [--subnet 10.10.10.0/24] [--gateway 10.10.10.1] \
[--dhcp-start 10.10.10.50] [--dhcp-end 10.10.10.150] \
[--mode normal|compat] [--country CZ] \
[--debug] \
[--forward SPEC]... \
[--lease MAC=IP]...Required positionals
WIFI_IF– wireless NIC (e.g.wlan0)UPLINK_IF– internet uplink (e.g.eth0)SSID– network nameWPA2_PSK– 8..63 chars
Named options
--channel N– 2.4 GHz channel (default1)--subnet CIDR– default10.10.10.0/24--gateway IP– default10.10.10.1--dhcp-start IP/--dhcp-end IP– default10.10.10.50–150--mode normal|compat– usecompatfor Realtek AU--country CC– regdomain (defaultCZ)--debug– print debug messages to stderr--forward SPEC– port forward rule (below)--lease MAC=IP– pin client leases
Logs (tailed live & saved):
/tmp/simpleap.<if>.<timestamp>.../{hostapd.log,dnsmasq.log,dnsmasq.leases}
--forward supports:
tcp|udp:INPORT=DSTPORT→ REDIRECT to local router (10.10.10.1:DSTPORT) e.g.--forward tcp:80=8080tcp|udp:INPORT=DSTIP:DSTPORT→ DNAT toDSTIP:DSTPORTe.g.--forward tcp:22=10.10.10.60:2222
Applied to client traffic arriving on WIFI_IF (PREROUTING).
Hairpin wlan0→wlan0 is allowed so DNAT to clients works.
While the AP is running in a terminal, flip client traffic between through the proxy and straight to the Internet on the fly — no restart:
- Press
p→ toggle a transparent REDIRECT of clienttcp {80 443}to the local proxy port (default8080, i.e. Burp/mitmproxy). - Press
q→ quit (same as Ctrl-C: everything is torn down).
# start with the proxy OFF (default) — press p to send traffic to Burp when you want it
sudo ./simpleap.sh wlan0 eth0 PentestAP StrongPass123 --mode compat --channel 1
# start with the proxy already ON, custom port / ports:
sudo ./simpleap.sh wlan0 eth0 PentestAP StrongPass123 \
--proxy-on --proxy-port 8080 --proxy-ports "80 443 8443"Options: --proxy-port N (default 8080), --proxy-ports "P.." (default "80 443"),
--proxy-on (start enabled). Each toggle also flushes the client's conntrack so the
new routing takes effect immediately for live flows. The toggle is independent of
--forward (which stays available for arbitrary custom REDIRECT/DNAT rules).
For intercepted HTTPS the device must trust your CA and the proxy must run in transparent/invisible mode on the target port. The hotkeys need a real terminal (a TTY); when the script is backgrounded it simply serves the AP without hotkeys.
--lease aa:bb:cc:dd:ee:ff=10.10.10.60
--lease 00:11:22:33:44:55=10.10.10.61-
Sets regdomain, kills
wpa_supplicantforWIFI_IF, unmanages it in NetworkManager. -
Configures
WIFI_IFto__ap, assignsGATEWAY/PREFIX, brings it up. -
Enables
net.ipv4.ip_forward=1. -
iptables (iptables-nft):
- INPUT: accept all from
WIFI_IF(router services reachable), plus explicit DHCP/DNS/ICMP accepts. - OUTPUT: accept to
WIFI_IF(router→clients). - FORWARD: accept both directions and
wlan0→wlan0(hairpin). - NAT: MASQUERADE on
UPLINK_IF. - PREROUTING NAT: installs
--forwardREDIRECT/DNAT rules.
- INPUT: accept all from
-
dnsmasq: binds to
GATEWAYonWIFI_IF, authoritative DHCP/DNS, verbose logs. -
hostapd: WPA2-PSK/CCMP on 2.4 GHz; compat disables 11n/WMM/PMF (most stable for AU).
-
Live tails both logs; Ctrl-C tears everything down.
- Root.
hostapd,dnsmasq,iptables,iw,ip,ss,tcpdump(optional).- Wi-Fi adapter supporting AP (
nl80211). Targeted: Realtek AWUS036ACS (8811/8812AU) on Kali VM + VMware/VirtualBox.
Install on Kali:
sudo apt update
sudo apt install -y hostapd dnsmasq iptables tcpdump
# optional Python CLI tooling manager (preferred over plain pip):
sudo apt install -y pipx python3-venv
pipx ensurepath
# Driver: on current kernels the in-tree rtw88 driver already supports AWUS AU cards
# (see "Driver setup" above) - no out-of-tree DKMS build needed.Phone stuck on “Obtaining IP address” Use a second terminal:
ss -lupn 'sport = :67 or :68 or :53' # dnsmasq bound to 10.10.10.1?
tcpdump -ni wlan0 -vvv port 67 or 68 # DHCPDISCOVER / OFFER / REQUEST / ACK visible?Two root causes seen on Realtek AU + Kali, both handled automatically now:
-
Client associates + 4-way handshake completes, then no DHCP and it disconnects (
tcpdumponwlan0shows no client frames, or only association inhostapd.log). This is thertw88USB adapter sleeping / USB-3 self-interference. Fix (applied by--install, persisted in/etc/modprobe.d/rtw88-ap.conf):options rtw88_core disable_lps_deep=Y options rtw88_usb switch_usb_mode=N # then: modprobe -r rtw88_8821au ... ; modprobe rtw88_8821au -
DISCOVER reaches
wlan0and iptables shows it accepted, but dnsmasq never answers — the host runs a native nftables firewall (table inet filter,nftables.service) withpolicy droponinput/forward. That base chain runs alongside the iptables (ip filter) chain this script edits, so an iptables ACCEPT is overridden by the inet-filter drop (DHCP dropped before dnsmasq; and forwarding/Internet blocked too).simpleap.shnow detects this and adds the matching accepts intoinet filter(removed again on Ctrl-C /--cleanup). Check:nft list chain inet filter input # should show iifname "wlan0" ... accept lines nft list chain inet filter forward # wlan0<->eth0 accepts present?
If DISCOVERs appear but no OFFERs and neither applies: another INPUT policy is dropping — ensure you ran the script as root and nothing else overwrote the rules.
SSID not visible
Use --mode compat and channel 1 or 6. Fresh SSID. If still dead, reload the module and retry:
sudo ip link set wlan0 down
sudo modprobe -r rtw88_8821au rtw88_8812au 2>/dev/null
sudo rfkill unblock all
sudo modprobe rtw88_8821au 2>/dev/null || sudo modprobe rtw88_8812au 2>/dev/nullMinimal hostapd check:
cat >/tmp/hapd-min.conf <<'EOF'
interface=wlan0
driver=nl80211
ssid=MINTEST
hw_mode=g
channel=6
wmm_enabled=0
ieee80211n=0
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_passphrase=12345678
wpa_pairwise=CCMP
EOF
sudo ip link set wlan0 up
sudo hostapd -dd /tmp/hapd-min.confTLS interception
--forward tcp:443=8080 breaks HTTPS unless the device trusts your CA. Install the Burp CA (or only redirect 80).
Crash cleanup (manual)
# defaults: wlan0 / eth0 / 10.10.10.0/24
sudo ./simpleap.sh --cleanup
# custom targets
sudo ./simpleap.sh --cleanup --wifi-if <WIFI_IF> --uplink-if <UPLINK_IF> --subnet <SUBNET>- This is a test harness, not a home AP: WLAN → router is wide open by design.
- Clients can talk to each other (AP isolation off).
- Use a legal country code and channels.
Driver workaround and procedure summarized from Sapsan’s article (thanks to Janek): https://sapsan-sklep.pl/en/blogs/articles/alfa-awus-kali-linux-2024-fix-en