Page cover image

AP-STA mode

AP-STA mode, also known as WiFi client AP mode or micro-AP, is a configuration that allows a Raspberry Pi (or other compatible device) to simultaneously act as both a wireless access point (AP) and a wireless client/station (STA).

This mode is particularly useful for IoT (Internet of Things) projects and embedded applications, especially when using the Raspberry Pi Zero W or Zero 2 W models, which have a single onboard wireless chipset.

Hardware Requirements

  • AP-STA mode requires a Raspberry Pi model with a wireless chipset that supports simultaneous operation as an access point and a wireless client.

  • The Raspberry Pi Zero W and Zero 2 W models are popular choices for this mode due to their compact size and onboard wireless chipset.

  • Other Raspberry Pi models with wireless capabilities, such as the Pi 3B+ and Pi 4, can also support AP-STA mode.

Wireless Chipset Capabilities

  • To use AP-STA mode, the wireless chipset must support simultaneous operation as an access point and a wireless client.

  • This capability can be verified by running the command iw list | grep -A 4 'valid interface' on the Raspberry Pi.

  • If the output includes a line indicating support for both "managed" (client) and "AP" modes, the chipset is capable of AP-STA mode.

Virtual Network Interface

  • In AP-STA mode, a virtual network interface (e.g., uap0) is created and added to the physical wireless interface (wlan0).

  • The virtual interface is used by various services required to operate a software access point, such as DHCP and DNS.

  • RaspAP, a popular wireless router software for Raspberry Pi, manages these configurations automatically in the background.

Configuration Files

  • When using AP-STA mode with RaspAP, several configuration files are modified to support the dual-mode operation:

    • dhcpcd.conf: Configures the static IP address for the virtual interface (uap0).

    • hostapd.conf: Specifies the virtual interface (uap0) as the interface for the access point.

    • dnsmasq.conf: Configures the DHCP and DNS settings for the virtual interface (uap0).

  • RaspAP handles these configurations automatically during the installation and setup process.

Startup and Reboot Behaviour

  • On AP-STA startup and system reboots, RaspAP's service control script adds the virtual interface (uap0) and brings it up before starting the access point software (hostapd).

  • This ensures that the virtual interface is available and properly configured before the access point starts.

  • RaspAP also disables the systemd-networkd service to prevent conflicts with the AP-STA configuration.

Installation and Setup

  • To set up AP-STA mode on a Raspberry Pi, you can use RaspAP's Quick Installer script.

  • The installer automatically detects if the Raspberry Pi lacks an active Ethernet (eth0) interface and configures AP-STA mode accordingly.

  • After installation, you can enable AP-STA mode through the RaspAP web interface by enabling the "WiFi client AP mode" option in the Hotspot > Advanced settings.

Limitations and Considerations

  • AP-STA mode on the Raspberry Pi is considered experimental and unsupported by RaspAP. It should be used for educational purposes or in scenarios where a reliable solution is not critical.

  • For more stable and reliable setups, it is recommended to use a second Wi-Fi adapter and follow the instructions in the RaspAP FAQ.

  • AP-STA mode requires the software AP to operate on the same channel as the Wi-Fi client connection, which may limit channel selection options.

AP-STA mode on the Raspberry Pi provides a convenient way to create a wireless access point while simultaneously connecting to another wireless network using a single wireless chipset.

This mode is particularly useful for IoT projects, embedded applications, and scenarios where a compact and integrated solution is desired.

However, it is important to understand the limitations and consider the reliability requirements of your project when deciding to use AP-STA mode.

Last updated

Was this helpful?