Raspberry Pi Hotspot
With NetworkManager
nmcli d wifi hotspot ifname wlan0 band bg ssid "SSID_NAME" password "PASSWORD"
nmcli c modify Hotspot wifi-sec.key-mgmt wpa-psk
nmcli c modify Hotspot 802-11-wireless.mode ap 802-11-wireless.band bg
nmcli c modify Hotspot ipv4.method shared ipv4.addresses "192.168.0.1/24"
nmcli c modify Hotspot wifi.hidden true
nmcli c up Hotspot ifname wlan0
The line wifi.hidden true
is only necessary if you want your WiFi SSID to be hidden (the name is not broadcasted and won't show up on normal UI's scans so you'll have to know the name and password and connect manually).
You can Check the config afterwards /etc/networkmanager/system-connections/Hotspot.nmconnection
[connection]
id=Hotspot
uuid=731772c2-989c-4912-b959-8e6e01b652d0
type=wifi
autoconnect=true
interface-name=wlan0
permissions=
timestamp=1706727640
[wifi]
band=bg
channel=1
hidden=true
mac-address-blacklist=
mode=ap
seen-bssids=D8:3A:DD:8D:F3:91;
ssid=SSID_NAME
[wifi-security]
group=ccmp;
key-mgmt=wpa-psk
pairwise=ccmp;
proto=rsn;
psk=PASSWORD
[ipv4]
addresses=192.168.0.1/24
dns-search=
method=shared
#address1=192.168.0.1/24,192.168.0.1
[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=ignore
[proxy]
Old way
apt install hostapd dnsmasq
Prepare and stop services:
systemctl stop hostapd
systemctl stop dnsmasq
Add to /etc/dhcpcd.conf
(change IP if wanted):
interface wlan0
static ip_address=192.168.0.10/24
nohook wpa_supplicant
Backup /etc/dnsmasq.conf
:
mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
Then create new one with this (use IP from above):
interface=wlan0
dhcp-range=192.168.0.11,192.168.0.30,255.255.255.0,24h
Create file /etc/hostapd/hostapd.conf
and change {NAME} and {PASS}:
interface=wlan0
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ssid={NAME}
wpa_passphrase={PASS}
Edit /etc/default/hostapd
, un-comment and edit this line:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Now unmask and enable hostapd:
systemctl unmask hostapd
systemctl enable hostapd
Restart.