Create a Wi-Fi Access Point named hotspot
with password ********
that:
- Shares internet from Ethernet if connected
- Serves local apps (like this example web app running on port 3000) even if no Ethernet
- Uses NetworkManager and nmcli only (no hostapd/dnsmasq/dhcpcd)
Prerequisites
- Raspberry Pi OS with NetworkManager installed and running
nmcli
CLI tool available- Node.js app or other local services listening on
0.0.0.0:3000
Step 0: Verify connections
Verify remaining connections:
nmcli connection show
should give you
Wired connection 1 c61e9bfe-c634-3354-95bd-d257f7800b6c ethernet eth0
MyPrivateWLAN edaf8d6e-29cd-4c51-83eb-806e50547623 wifi wlan0
lo 0a78e945-7563-4f93-a852-6fde5fa167d6 loopback lo
preconfigured 72a7caee-a05e-4145-9560-6768ab9da58d wifi --
Step 1: Create the Wi-Fi Access Point
Create a new Wi-Fi AP connection with SSID my-hotspot and password ********:
sudo nmcli connection add type wifi ifname wlan0 con-name my-hostpot ssid hostpot
sudo nmcli connection modify hostpot mode ap
sudo nmcli connection modify hostpot 802-11-wireless.band bg
sudo nmcli connection modify hotspot 802-11-wireless.channel 6
sudo nmcli connection modify hotspot wifi-sec.key-mgmt wpa-psk
sudo nmcli connection modify hotspot wifi-sec.psk "**********"
sudo nmcli connection modify hotspot ipv4.addresses 192.168.4.1/24
sudo nmcli connection modify hotspot ipv4.method shared
sudo nmcli connection modify hotspot connection.autoconnect yes
The ipv4.method shared enables DHCP and NAT for the Wi-Fi clients.
Clients connecting to the AP get IPs in the 192.168.4.x range.
The Pi’s AP IP is 192.168.4.1.
Step 2: Configure Ethernet (if needed, specially if you cannot access the Pi with a monitor and a keyboard)
Create or ensure Ethernet connection exists and uses DHCP:
sudo nmcli connection add type ethernet ifname eth0 con-name ethernet
sudo nmcli connection modify ethernet ipv4.method auto
sudo nmcli connection up ethernet
Step 3: Start the Access Point
Bring the AP connection up:
sudo nmcli connection up hotspot
Step 4: Verify the Setup
Check that wlan0 is in AP mode:
iw dev
Expected output snippet:
Interface wlan0
ifindex 3
wdev 0x1
addr 2c:cf:67:f9:25:e2
ssid hotspot
type AP
channel 6 (2437 MHz), width: 20 MHz, center1: 2437 MHz
txpower 31.00 dBm
Check device status:
nmcli device status
Expected output:
DEVICE TYPE STATE CONNECTION
wlan0 wifi connected hotspot
eth0 ethernet connected ethernet
lo loopback connected (externally) lo
Step 5: Connect and Test
- Connect any Wi-Fi device to SSID: hotspot
- Use password: **********
- Check that the device gets IP like 192.168.4.x
- Access your Node.js app at: http://192.168.4.1:3000 or http://hotspot.local:3000
- If Ethernet is plugged in, internet access is shared automatically
Step 6: Enable Autoconnect on Boot
Make sure connections start on boot:
sudo nmcli connection modify hotspot connection.autoconnect yes
sudo nmcli connection modify ethernet connection.autoconnect yes
Step 7: Make sure your Pi’s hostname is hotspot
Check hostname:
hostname
If it’s not hotspot, set it:
sudo hostnamectl set-hostname hotspot
Then reboot or restart hostname services.
Step 8: Ensure avahi-daemon (mDNS) is installed and running
avahi-daemon provides .local hostname resolution on the local network, even without internet.
Install and start:
sudo apt install avahi-daemon
sudo systemctl enable avahi-daemon
sudo systemctl start avahi-daemon
Step 9: Add a fallback static IP entry for hotspot.local on clients (optional)
If your clients don’t support mDNS or .local resolution:
Access the Node.js app directly via IP: http://192.168.4.1:3000
Or add a manual hosts file entry on each client mapping hotspot.local to 192.168.4.1
Notes
If you are on a Mac or on an iPad / iPhone, make sure Private Relay is disabled, otherwise your machine cannot connect to Private Relay and gives you no access to `http://hotspot.local:3000`.