I am looking to create an access point to share the internet of a Ubuntu Desktop box. The copy of Ubuntu was installed with Gnome but X was disabled on startup so it is ssh/cmd only for the most part.
$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
$ sudo nmcli device status | grep wifi
wlx347de4403656 wifi disconnected
Wifi Device Exists and is a USB BrosTrend USB wifi adapter for Linux – AC1L
$ sudo nmcli -f WIFI-PROPERTIES.AP device show wlx347de4403656
WIFI-PROPERTIES.AP: yes
Wifi Device Supports AccessPoint mode
So the Wifi Device is there and supports AP mode. So now creating the AP bit.
$ sudo nmcli c add type wifi ifname wlx347de4403656 con-name hotspot autoconnect yes ssid ouch
Connection 'hotspot' (b176bbf9-8a39-497a-9f74-21a2971af14e) successfully added.
/etc/NetworkManager/system-connections$ ls
hotspot.nmconnection 'Wired connection 1.nmconnection'
So the nmconnection file is created.
$sudo nmcli connection modify hotspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
This sets the configuration file to AP or access point mode on bands bg sharing via IPv4.
$sudo nmcli connection modify hotspot wifi-sec.key-mgmt wpa-psk
This tells the wifi ap to use WPA-PSK
$sudo nmcli connection modify hotspot wifi-sec.psk "password"
This sets the password for the wifi ap.
/etc/NetworkManager/system-connections$ sudo cat hotspot.nmconnection
[connection]
id=hotspot
uuid=b176bbf9-8a39-497a-9f74-21a2971af14e
type=wifi
interface-name=wlx347de4403656
timestamp=1717281836
[wifi]
band=bg
mode=ap
ssid=ouch
[wifi-security]
key-mgmt=wpa-psk
psk=password
[ipv4]
method=shared
[ipv6]
addr-gen-mode=stable-privacy
method=auto
[proxy]
Now turned it on:
$ sudo nmcli connection up hotspot
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
Now when i search for WiFi i can see an SSID called ouch. On my android phone i see it as Ouch with WPA3(SAE Transition Mode).
If i try to connect i attempts and fails. The same happens if i try to connect via my laptop. I have no feedback as to why.
$ ss -tulpn | egrep ":53|:67"
udp UNCONN 0 0 10.42.0.1:53 0.0.0.0:*
udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0:67 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0:5353 0.0.0.0:*
udp UNCONN 0 0 [::]:53863 [::]:*
udp UNCONN 0 0 [::]:5353 [::]:*
tcp LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*
tcp LISTEN 0 32 10.42.0.1:53 0.0.0.0:*
From this i can see that it is looking to offer IP on the default 10.42.0.1 range listening on port 53 (dnsmasq I guess or something similar).
$ sudo nft list ruleset
table ip nm-shared-wlx347de4403656 {
chain nat_postrouting {
type nat hook postrouting priority srcnat; policy accept;
ip saddr 10.42.0.0/24 ip daddr != 10.42.0.0/24 masquerade
}
chain filter_forward {
type filter hook forward priority filter; policy accept;
ip daddr 10.42.0.0/24 oifname "wlx347de4403656" ct state { established, related } accept
ip saddr 10.42.0.0/24 iifname "wlx347de4403656" accept
iifname "wlx347de4403656" oifname "wlx347de4403656" accept
iifname "wlx347de4403656" reject
oifname "wlx347de4403656" reject
}
}
I am no expert in any of this but from what i can see the rules are there for the wifi network card too.
I just don’t know what else to do or check as I simply can not connect to it. Any help appreciated.
OK I tried one last thing … and it now works after this long post so will post anyway in case it helps someone else. The bit that got it working for me was:
$sudo nmcli c modify Hotspot 802-11-wireless-security.pmf 1
This I believe disables “Protected Management Frames”. Thank you to @Dzamo Norton from this post https://askubuntu.com/questions/1424633/unable-to-connect-with-the-hotspot-created-on-ubuntu
If you make any changes to the file hotspot.nmconnection be sure to run the following command or they won’t take effect.
$ sudo systemctl restart NetworkManager
If you find your AP / SSID keeps disappearing it might be that you have IP v6 enabled and it is not supported by the hardware. If so … disable it with:
sudo nmcli connection modify hotspot ipv6.method "disabled"
Didn’t help … try eiiting:
/etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
and setting the value to 1 or 0.
The access point keeps disappearing seems to come back when you ssh in and restart NetworkManager but I have no idea why ? Any help would be appreciated.