Solved: Wifi Hotspot does not work

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.