Solved: Wifi Hotspot does not work

Hello, I have been trying to make my laptop wifi hotspot work at my dorm, since we cannot have routers here.

I am using KDE Plasma and I have tried both the built-in hotspot and linux-wifi-hotspot.

My phone cannot even connect to the built-in hotspot, saying that Network Does not Exist, that is when using password.
When not using password, it connects and says No Data Connection.

linux-wifi-hotspot is in a similar vein. I can create the hotspot, either through the gui or cli, but my phone gets stuck in a connection loop. What I mean is, the network is recognized but it does not connect even if it tries to.

kinfo

Operating System: EndeavourOS 
KDE Plasma Version: 6.3.0
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.12.13-1-lts (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i5-9300H CPU @ 2.40GHz
Memory: 39.0 GiB of RAM
Graphics Processor 1: Mesa Intel® UHD Graphics 630
Graphics Processor 2: llvmpipe

lspci

00:14.3 Network controller: Intel Corporation Cannon Lake PCH CNVi WiFi (rev 10)
        DeviceName: Onboard - Ethernet
        Subsystem: Intel Corporation Wireless-AC 9560
        Kernel driver in use: iwlwifi
        Kernel modules: iwlwifi

Edit: For additional information, I have installed EndeavourOS recently for up-to-date packages after using Ubuntu and Debian for multiple years, where this worked fine.

I have solved this already, but keeping it up since it can be useful in the future.

Small clarification - I don’t know if the firewall is from plasma or the OS itself.

Solution #1 - Plasma Built-in Hotspot: I didn’t know that plasma nowadays has a built-in firewall. I have been using ufw for a long time, so I installed it when I installed the OS. Disabling and uninstalling it solved the issue for the built-in hotspot.

Solution #2 - linux-wifi-hotspot: Due to the firewall inside plasma it does not work and the hotspot needs to be allowed inside of it.

sudo firewall-cmd --add-service=dhcp
sudo firewall-cmd --add-service=dns
sudo firewall-cmd  --add-masquerade

sudo firewall-cmd -q --direct --add-rule ipv4 nat POSTROUTING 0 -o <ap_iface> -j MASQUERADE
sudo firewall-cmd -q --direct --add-rule ipv4 filter FORWARD 0 -i <internet_iface> -o <ap_iface> -j ACCEPT
sudo firewall-cmd -q --direct --add-rule ipv4 filter FORWARD 0 -i <ap_iface> -o <internet_iface> -m state --state RELATED,ESTABLISHED -j ACCEPT

Taken from an Issue on github from an EndeavourOS user

  • <ap_iface> is in my case wlan0
  • <internet_face> is in my case the ethernet, so enp3s0
1 Like

Full Solution

Plasma 6 Built-In Hotspot

Plasma 6 nowadays has a built-in firewall, so if something does not work with your hotspot, you most likely installed ufw or another firewall. Uninstall it.

Linux Wifi Hotspot

Plasma 6 Firewall by default does not allow Linux Wifi Hostspot to work.
You need to run the commands:

sudo firewall-cmd --add-service=dhcp
sudo firewall-cmd --add-service=dns
sudo firewall-cmd  --add-masquerade

sudo firewall-cmd -q --direct --add-rule ipv4 nat POSTROUTING 0 -o <ap_iface> -j MASQUERADE
sudo firewall-cmd -q --direct --add-rule ipv4 filter FORWARD 0 -i <internet_iface> -o <ap_iface> -j ACCEPT
sudo firewall-cmd -q --direct --add-rule ipv4 filter FORWARD 0 -i <ap_iface> -o <internet_iface> -m state --state RELATED,ESTABLISHED -j ACCEPT

and replace <ap_iface> with your wifi interface (most likely wlan0 or wlo1), <internet_iface> with your internet source so an ethernet interface (in my case enp3s0).

These commands add the required rules to the firewall for Linux Wifi Hotspot to work, but the rules will reset every reboot.

As a workaround to this, you can save these commands to a file (maybe like in ~/.local/bin/hotspot-fw and make it executable (ex. chmod +x ~/.local/bin/hotspot-fw).

The you create a new service file under /etc/systemd/system:

sudo nano /etc/systemd/system/hotspot-fw.service

Paste in:

[Unit]
Description=Adding Firewall Rules for linux-wifi-hotspot
After=multi-user.target

[Service]
ExecStart=/usr/bin/bash /home/<user>/.local/bin/hotspot-fw
Type=simple

[Install]
WantedBy=multi-user.target

Replace <user> with your username and save.

Run sudo systemctl daemon-reload and sudo systemctl enable hotspot-fw and reboot.

The firewall will be now set-up every reboot and you can use Linux Wifi Hotspot without any hassle.

What packages are that firewall you are refereing to: pacman -Qs firewall?
Are you talking about firewalld and plasma-firewall ?

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.