Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6129

nmcli Hotspot cant connect

$
0
0

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 -aDistributor ID: UbuntuDescription:    Ubuntu 22.04.4 LTSRelease:        22.04Codename:       jammy$ sudo nmcli device status | grep wifiwlx347de4403656  wifi      disconnected 

Wifi Device Exists and is a USB BrosTrend USB wifi adapter for Linux - AC1L

$ sudo nmcli -f WIFI-PROPERTIES.AP device show wlx347de4403656WIFI-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 ouchConnection '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=hotspotuuid=b176bbf9-8a39-497a-9f74-21a2971af14etype=wifiinterface-name=wlx347de4403656timestamp=1717281836[wifi]band=bgmode=apssid=ouch[wifi-security]key-mgmt=wpa-pskpsk=password[ipv4]method=shared[ipv6]addr-gen-mode=stable-privacymethod=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 rulesettable 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

I might as well ask another question. The DHCP it sets up is this only available via the Wifi adapter ? Please say yes or there will be very angry network admin somewhere =)


Viewing all articles
Browse latest Browse all 6129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>