On Raspberry pi 4 with Ubuntu Mate 22.04
I want to create a wifi hotspot. The mobile connects but the connection is blocked by the ufw firewall.
What rules should I add to ufw?
Did you see
- To ensure that the reason of failure is
ufw
please check its status with the commandsudo ufw status
. Ifufw
is active please show us ufw rules in effect. - If the purpose of your hotspot is to provide Internet access, then verify if routing is turned on and check routing table.
$ sudo ufw status
Stav: aktivní
53 ALLOW 10.42.0.1
After disabling ufw, the connection to the mobile works.
I don't know what routing is.
By default, UFW is configured to deny all incoming connections but allow all outgoing connections That is you need to allow incoming connections from the whole hotspot-associated subnet or from your mobile IP only. Or disable UFW.
The following link definitely may help to accomplish the task:
I don't want to disable ufw, I'm looking for the right rule.
Terminal output:
$ ip addr
1: lo: ...
2: eth0: ...
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether dc:a6:32:25:1e:03 brd ff:ff:ff:ff:ff:ff
inet 10.42.0.1/24 brd 10.42.0.255 scope global noprefixroute wlan0
valid_lft forever preferred_lft forever
inet6 fe80::abe6:f2c3:a91e:32c8/64 scope link noprefixroute
valid_lft forever preferred_lft forever
$ sudo nano /etc/default/ufw
IPV6=yes
It looks like you need rule
sudo ufw allow from 10.42.0.0/24
added
~$ sudo ufw status
Stav: aktivní
Anywhere ALLOW 10.42.0.0/24
but it didn't help
Try to disable/enable UFW to ensure that the rule is activated. If that would not help... I'm sorry, I'm out of ideas for now.