Simple Standalone Network Manager wifi hotspot

I want to create a simple standalone wifi hotspot with networkmanager on a Rasbperry Pi Zero 2 W, so not a shared connection, just a hotspot.

There are numerous example how to do that, for example:

nmcli con add con-name hotspot ifname wlan0 type wifi ssid "MyHotspot"
nmcli con modify hotspot wifi-sec.key-mgmt wpa-psk
nmcli con modify hotspot wifi-sec.psk "MyPassword"
nmcli con modify hotspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared

(or by creating the equivalent config file e.g. with networking.networkmanager.ensureProfiles)

However, all these examples apparently want to share the network with an already established ethernet connection - which I don’t have on the Pi! So while the above commands do create a hotspot, client’s can’t connect and the connection hangs indefinitely - I guess because they don’t get an IP? A missing DHCP server on the Pi? I have no idea of all this networking stuff to be honest. :upside_down_face:

I read that dnsmasq is necessary, so I set services.dnsmasq.enable = true, but of course that didn’t do anything. So do I need dhcpcdor something? Would be awesome if someone could point me into the right direction - so we can update this not very helpful wiki page.

I don’t really care whether hostnames etc. work in that hotspot. I’d already be happy if clients can just connect and ssh into the router/default gateway ip, that’s all I want for now.

You will probably also need to open some firewall ports: Nftables firewall blocks requests to dnsmasq DHCP · Issue #263359 · NixOS/nixpkgs · GitHub

1 Like

That was totally it, this made it work instantly:

  # DHCP ports for hotspot
  networking.firewall.allowedUDPPorts = [ 67 68 ];