Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8041

Networking and servers • Re: Hotspot with hostapd

$
0
0
I bought a USB wifi adaptor to use to set up a hotspot.

This is on a Pi 5 running Debian 10 with command line only; no GUI.

It's impossible to use `nmcli` to set up a hotspot because you can't tell it whether to use `wlan0` or `wlan1` so I set up `hostapd` and I couldn't find anything about adding the interface to the bridge.

Any idea what's going on?
It's most definitely possible to set up a hotspot using nmcli. I've used hostapd in the past, but nmcli works great so I've switched to using that.

sdm's hotspot capability uses nmcli exclusively and works great. Documentation here and here.

Here's a simple script that installs sdm and then configures the hotspot as either a bridged or routed hotspot, or a routed hotspot using an onboard independent DNS/DHCP server instead of NetworkManager's built-in DHCP server.

Of course, if you'd prefer not to use sdm you can read the hotspot plugin code and pluck out the nmcli commands to use on your own.

Code:

#!/bin/bash[ "$1" == "" ] && hstype="routed" || hstype="$1"[[ "bridged|routed|routed2" =~ $hstype ]] || { echo "? argument must be 'routed' (default) or 'bridged'" ; exit ; }echo "> Install sdm"curl -L https://raw.githubusercontent.com/gitbls/sdm/master/install-sdm | bashcase "$hstype" in    bridged)        echo "> Configure bridged hotspot on this system"        sdm --runonly plugins --oklive --plugin hotspot:"hsname=myhs|ipforward=eth0|hsenable|type=bridged"        ;;    routed)        echo "> Configure routed hotspot on this system"        sdm --runonly plugins --oklive --plugin hotspot:"hsname=myhs|ipforward=eth0|hsenable|type=routed|dhcpmode=nm"        ;;    routed2)        echo "> Configure routed hotspot and DNS/DHCP on this system"        sdm --runonly plugins --oklive --plugin hotspot:"hsname=myhs|ipforward=eth0|hsenable|type=routed|dhcpmode=none|wlanip=10.6.0.1" --plugin ndm:"dhcpserver=dnsmasq|dnsserver=dnsmasq|dobuild|doinstall|dhcprange=10.6.0.2,10.6.0.100|domain=me|externaldns=1.1.1.1|gateway=10.6.0.1|myip=10.6.0.1|hostname=myap|dnsfqdn=myap.me|mxfqdn=myap.me|timeserver=192.168.92.3|netdev=wlan0|enablesvcs"        ;;esacexit
Lastly, you mentioned you're running Debian 10 on a Pi5. Since the Pi5 requires Bookworm, which has the Pi5 support, was that "10" a typo, or did you really bend over backwards to bring up Debian 10 on that Pi5?

Statistics: Posted by bls — Fri Dec 12, 2025 2:28 pm



Viewing all articles
Browse latest Browse all 8041

Trending Articles