Skip to content

Instantly share code, notes, and snippets.

@narate
Last active May 16, 2024 04:35
Show Gist options
  • Save narate/d3f001c97e1c981a59f94cd76f041140 to your computer and use it in GitHub Desktop.
Save narate/d3f001c97e1c981a59f94cd76f041140 to your computer and use it in GitHub Desktop.
Create Wi-Fi Hotspot on Linux using nmcli

Create a Wi-Fi hotspot on Linux using nmcli

Original post : https://unix.stackexchange.com/a/310699

nmcli con add type wifi ifname wlan0 con-name Hostspot autoconnect yes ssid Hostspot
nmcli con modify Hostspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
nmcli con modify Hostspot wifi-sec.key-mgmt wpa-psk
nmcli con modify Hostspot wifi-sec.psk "veryveryhardpassword1234"
nmcli con up Hostspot

Note

If after reboot nmcli con up Hotspot doesn't work

Use this command instead to start Hotspot

UUID=$(grep uuid /etc/NetworkManager/system-connections/Hotspot | cut -d= -f2)
nmcli con up uuid $UUID
@lalvesl
Copy link

lalvesl commented Feb 19, 2024

Thank you all, especially abhishekmj303 for this argument (802-11-wireless-security.pmf 1)

@arrio464
Copy link

Excellent!
In some cases, you may need:

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

@mohamad-supangat
Copy link

reference on https://owlhowto.com/how-to-create-a-wifi-hotspot-on-debian-12/

using this to auto create hotspot on boot

nmcli con mod Hostspot connection.autoconnect yes

@opeolluwa
Copy link

reference on https://owlhowto.com/how-to-create-a-wifi-hotspot-on-debian-12/

using this to auto create hotspot on boot

nmcli con mod Hostspot connection.autoconnect yes

Let me get this, it's possible to create hotspot without being connected to a WiFi?

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