LinuxCommandLibrary

create_ap

Create a WiFi access point

TLDR

Create an open network with no passphrase

$ create_ap [wlan0] [eth0] [access_point_ssid]
copy

Use a WPA + WPA2 passphrase
$ create_ap [wlan0] [eth0] [access_point_ssid] [passphrase]
copy

Create an access point without Internet sharing
$ create_ap -n [wlan0] [access_point_ssid] [passphrase]
copy

Create a bridged network with Internet sharing
$ create_ap -m bridge [wlan0] [eth0] [access_point_ssid] [passphrase]
copy

Create a bridged network with Internet sharing and a pre-configured bridge interface
$ create_ap -m bridge [wlan0] [br0] [access_point_ssid] [passphrase]
copy

Create an access port for Internet sharing from the same Wi-Fi interface
$ create_ap [wlan0] [wlan0] [access_point_ssid] [passphrase]
copy

Choose a different Wi-Fi adapter driver
$ create_ap --driver [wifi_adapter] [wlan0] [eth0] [access_point_ssid] [passphrase]
copy

SYNOPSIS

create_ap [options] <wlan_iface> [<internet_iface>] <ssid> <passphrase>

PARAMETERS

-w IFACE, --wlan IFACE
    Wireless interface (default: first wireless)

-i IFACE, --internet IFACE
    Internet source interface (default: eth0)

-c CHANNEL, --channel CHANNEL
    WiFi channel 1-13 (default: 1)

-e SSID, --ssid SSID
    Access point name (default: positional arg)

-p PASSPHRASE, --passphrase PASSPHRASE
    WPA2 key, 8-63 chars (default: positional)

-s, --no-dns
    Skip starting dnsmasq (DHCP/DNS)

-n, --no-hostapd
    Skip starting hostapd (AP mode)

--no-virt
    No virtual interface creation

-k, --wep
    Use WEP encryption (insecure)

-f, --force
    Ignore detection issues

-b BAND, --band BAND
    20 or 40 MHz band (default: max)

--country CODE
    ISO country code (e.g., US)

--debug
    Enable debug output

--list
    List wireless interfaces

--help
    Show usage help

DESCRIPTION

The create_ap command is a Perl script that transforms a Linux wireless interface into a fully functional WiFi access point (AP). It automates configuration of hostapd to enable AP mode, dnsmasq for DHCP and DNS services (assigning IPs in 172.24.1.0/24 range), and iptables rules for NAT to share internet from another interface like Ethernet.

Ideal for Raspberry Pi, embedded devices, or ad-hoc hotspots. Supports WPA2-PSK by default (12+ char passphrase required), with WEP option. Users specify wireless iface (e.g., wlan0), optional internet source (e.g., eth0), SSID, and passphrase.

Key features: auto-detects wireless interfaces, creates virtual AP interface if needed (mac80211), forces channel/band, country code support. Kills conflicting services like NetworkManager. Runs as root; stops cleanly with Ctrl+C.

Limitations: chipset must support AP mode (iw list check). Not for high-traffic production; basic security. Install via GitHub (oblique/create_ap). Requires hostapd, dnsmasq, iw, iptables.

CAVEATS

Requires root. Wireless must support AP mode (iw list). Conflicts with NetworkManager/systemd-resolved. Passphrase min 8 chars for WPA2. No IPv6. Entropy issues? Install haveged. Not production-ready; exposes DHCP/NAT.

REQUIREMENTS

hostapd, dnsmasq, iw, iptables, wireless-tools. Kernel ≥ 3.2, mac80211 drivers.

STOP/REMOVE

Ctrl+C to stop. Manual: killall create_ap hostapd dnsmasq; iptables -t nat -F POSTROUTING; sysctl -w net.ipv4.ip_forward=0.

HISTORY

Created ~2015 by Jan-Michael Vincent (Oblique Strategies/Datto) for easy Pi hotspots. Open-sourced on GitHub (oblique/create_ap), 3k+ stars. Evolved with contribs for band/channel/country. Maintained sporadically; forks active.

SEE ALSO

hostapd(8), dnsmasq(8), iw(8), iptables(8), aircrack-ng(8)

Copied to clipboard