Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save max-pfeiffer/9e8e76d190698cc8381b75399c1ded1d to your computer and use it in GitHub Desktop.
Save max-pfeiffer/9e8e76d190698cc8381b75399c1ded1d to your computer and use it in GitHub Desktop.
Create a Wifi Hotspot on Raspberry Pi with NetworkManager

Create a Wifi Hotspot on Raspberry Pi with NetworkManager (Rasbian v12, Debian Bookworm)

Create a wifi hotspot like this:

sudo nmcli connection add con-name <NAME> type wifi ifname <INTERFACE> wifi.mode ap wifi.ssid <SSID> wifi-sec.key-mgmt wpa-psk wifi-sec.psk <PASSWORD> ipv4.method shared

That is a minimal configuration which should work on all Raspberry Pi devices from v3 upwards. Problem with this configuration is, that it only provides weak WPA encryption/security.

To remedy this you can switch on some additonal security features:

sudo nmcli connection modify <NAME> wifi-sec.proto rsn wifi-sec.pairwise ccmp wifi-sec.group ccmp

But this could result in clients not being able to connect to the Hotspot.

You can also use a more convenient configuration shortcut, which provides a Hotspot with these security features already enabled:

sudo nmcli device wifi hotspot con-name <NAME> ifname <INTERFACE> ssid <SSID> password <PASSWORD> 

Create Hotspot On Startup

If you want to have the hotspot up and running after reboot, you need to modify the connection with these parameters:

sudo nmcli connection modify <name> connection.autoconnect yes connection.autoconnect-priority 100

Official Documentation

See: https://networkmanager.dev/docs/api/latest/

@mroelandts
Copy link

When I manually start the wifi hotspot everything is fine but after a reboot all connected clients are not able to access the internet. (ping 8.8.8.8)
I have already found that after a startup, there are no nft tables.
The command sudo nft list tables returns nothing. (meaning the nft tables are empty)
Restarting the NetworkManager through systemd resolves this and you will see the tables be executing the sudo nft list tables again. All connected devices will now be able to ping 8.8.8.8.
sudo journalctl -u NetworkManage is not reporting any issues after the boot.
Am I missing some configuration? Did you have the same issue during "Create Hotspot on Startup"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment