Ubuntu 22.04 configure Access Point by shell commands
with NMCLI command line you can create your own access point with a few commands :
nmcli con add type wifi ifname wlan0 con-name Hostspot autoconnect yes ssid MioSSID 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 modify Hostspot ipv4.method manual ipv4.addresses 192.168.42.1/24 nmcli con up Hostspot
make sure with “nmcli connection show” that you haven’t left halfway configurations or double configurations, in case you can remove them with “nmcli connection delete Hostspot”
The only flaw of nmcli is that it does not have a specific command to directly set the DHCP service that supports the newly configured AP and to do this you need to install and configure a service that takes care of this, such as “dnsmasq”:
sudo apt install dnsmasq
edit the configuration file “dnsmasq.conf”
sudo nano /etc/dnsmasq.conf
personalli i modified only some lines in the configuration file:
Port=5353 interface=wlo1 dhcp-range=192.168.42.100,192.168.42.200,12h
restart service:
sudo service dnsmasq restart
check WiFi state:
iw dev
reboot your system and check it all