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] <interface_to_share_internet> <interface_for_ap> <ssid> [passphrase]
create_ap -g [options] <interface_for_ap> <ssid> [passphrase]
create_ap -h | --help | --version

PARAMETERS

-w {1,2,3}
    Specify Wi-Fi security type: 1 for WPA, 2 for WPA2, 3 for WPA/WPA2 mixed mode.

-g
    Do not share Internet. Creates a local AP without NAT (no gateway).

-d, --no-dns
    Disable the DNS server provided by dnsmasq.

-s, --no-dhcp
    Disable the DHCP server provided by dnsmasq.

-c, --no-hostapd
    Do not run hostapd. Only useful with custom configurations or specific setups.

-k, --no-iptables
    Do not configure iptables. No NAT or firewall rules will be set up.

--daemon
    Run create_ap in the background as a daemon.

--channel {num}
    Set the Wi-Fi channel for the Access Point (e.g., 1, 6, 11).

--freq-band {2.4|5}
    Specify the frequency band for the AP (2.4GHz or 5GHz).

--country {code}
    Set the country code (e.g., US, DE) which affects legal channels and power levels.

--ap-ip {ip}
    Set the IP address for the AP's interface (e.g., 192.168.12.1).

--hidden
    Hide the SSID (Service Set Identifier) so it is not broadcasted.

--ieee80211n
    Enable IEEE 802.11n (Wi-Fi 4) support for the AP.

--ieee80211ac
    Enable IEEE 802.11ac (Wi-Fi 5) support for the AP (requires compatible hardware).

--driver {driver}
    Specify the hostapd driver to use (e.g., nl80211, wext).

--list-drivers
    List the hostapd drivers supported by your wireless card.

--mac-filter
    Enable MAC address filtering. Requires --mac-filter-accept or --mac-filter-deny.

--mac-filter-accept {macs}
    Only allow comma-separated MAC addresses to connect. Implies --mac-filter.

--mac-filter-deny {macs}
    Deny comma-separated MAC addresses from connecting. Implies --mac-filter.

DESCRIPTION

create_ap is a powerful shell script designed to simplify the process of establishing a Wi-Fi Access Point (AP) on Linux systems. It acts as a wrapper around several core networking utilities, including hostapd for managing the AP, dnsmasq for DHCP and DNS services, and iptables for network address translation (NAT) and routing. This command abstracts away the complexities of configuring these individual components, allowing users to quickly set up a shared internet connection or a local network hotspot with just a single command. It supports various security protocols like WPA and WPA2, and offers options for both wired-in-wireless-out and wireless-in-wireless-out configurations. Its primary advantage lies in its ease of use, making it accessible even for users not deeply familiar with Linux network configurations. It's an excellent tool for sharing internet from an Ethernet connection, or extending an existing Wi-Fi connection, turning your Linux machine into a portable router.

CAVEATS

create_ap requires root privileges to function.
It can conflict with NetworkManager. It's often recommended to stop or disable NetworkManager for the interface used by create_ap to avoid conflicts.
Success heavily depends on your wireless adapter's chipset and its Linux driver support for AP mode (hostapd compatibility). Not all Wi-Fi cards support this.
Ensure your kernel's module `mac80211` is properly loaded and supports AP mode for your device.
For some advanced features like 802.11ac/ax, specific hardware and driver support are crucial.
While convenient, it's a script, and less robust than a dedicated router or a more complex hostapd setup for critical production environments.

<B>PREREQUISITES</B>

To run create_ap, you typically need hostapd, dnsmasq, iptables, and iw utilities installed on your system. These are standard packages on most Linux distributions. Ensure your wireless card supports AP mode and the necessary drivers are loaded.

<B>COMMON USAGE SCENARIOS</B>

1. Share Ethernet to Wi-Fi:
create_ap wlan0 eth0 MyHotspot MyPassword
(Shares internet from eth0 via Wi-Fi on wlan0)

2. Share Wi-Fi to Wi-Fi (repeater-like):
create_ap wlan0 wlan1 MyHotspot MyPassword
(Requires two wireless cards, or a single card capable of concurrent AP+station mode, which is rare)

3. Local Wi-Fi Network (no Internet):
create_ap -g wlan0 MyLocalAP
(Creates an AP for local devices without internet sharing)

4. WPA2 with custom channel:
create_ap -w 2 --channel 6 wlan0 eth0 SecureAP MyStrongPass

HISTORY

create_ap is an open-source project hosted on GitHub, primarily developed by oblique/create_ap. Its development started as a response to the need for a simpler way to set up Wi-Fi access points on Linux, abstracting the complexities of manually configuring hostapd, dnsmasq, and iptables. It quickly gained popularity within the Linux community due to its ease of use and comprehensive feature set for a single script. It continues to be maintained by contributors, adapting to new kernel features and network technologies, though updates might be less frequent than for core system utilities. Its primary impact has been democratizing Wi-Fi AP creation on Linux.

SEE ALSO

hostapd(8), dnsmasq(8), iptables(8), iwconfig(8), nmcli(1), ip(8)

Copied to clipboard