Fallback Wi-Fi provisioning for a Raspberry Pi with one wireless interface.
Normal behaviour:
- NetworkManager attempts to connect to a saved Wi-Fi network.
- If no Wi-Fi connection is available, the Pi broadcasts
SETUP-PRINTER. - A phone connects to that hotspot and opens the captive portal.
- The user enters the destination Wi-Fi credentials.
- The Pi stops the hotspot, creates a NetworkManager connection, and connects.
- If the connection fails, the setup hotspot returns.
Designed for Raspberry Pi OS Bullseye on a Raspberry Pi 3 A+, using:
- NetworkManager for normal Wi-Fi
- hostapd for setup access-point mode
- dnsmasq for setup DHCP and captive DNS
- Python 3 standard library for the portal
- systemd for orchestration
git clone <repository-url>
cd setup-printer-wifi
sudo ./install.shThe installer prompts for:
- Hotspot SSID, default
SETUP-PRINTER - Hotspot password
- Wi-Fi country, default
GB - Fallback timeout, default
45seconds
Reboot after installation:
sudo rebootRemove all saved Wi-Fi profiles and start setup mode:
sudo setup-printer-resetThis disconnects Wi-Fi immediately. Do not run it over Wi-Fi SSH unless you have local console access.
sudo setup-printer-statusDetailed logs:
sudo journalctl -u setup-printer-controller.service -b --no-pager
sudo journalctl -u setup-printer-portal.service -b --no-pagersudo setup-printer-hotspot startReturn to client mode:
sudo setup-printer-hotspot stop
sudo systemctl restart NetworkManagerEdit:
sudo nano /etc/setup-printer/configThen restart:
sudo systemctl restart setup-printer-controller.servicesudo ./uninstall.shThis setup deliberately stops NetworkManager while the hotspot is active because the Raspberry Pi 3 A+ has one Wi-Fi interface. NetworkManager is restarted before applying submitted credentials.
The portal listens on TCP port 8080. dnsmasq redirects captive-portal HTTP traffic from port 80 to port 8080 using nftables or iptables. This avoids conflicts with nginx or Apache already using port 80 outside setup mode.