Error when trying to enable ufw logs on Ubuntu
I am trying to enable logs for ufw.
When I do sudo ufw status
I get
Status: active
To Action From
-- ------ ----
53535 ALLOW Anywhere
9090 ALLOW Anywhere
1883 ALLOW Anywhere
22 ALLOW Anywhere
53535 (v6) ALLOW Anywhere (v6)
9090 (v6) ALLOW Anywhere (v6)
1883 (v6) ALLOW Anywhere (v6)
22 (v6) ALLOW Anywhere (v6)
Which is ok
Then I try to enable logs:
[root@artik log]# ufw logging on ERROR: Could not update running firewall
So I try to disable firewall, enable logging and restart ufw
[root@artik log]# ufw disable
Firewall stopped and disabled on system startup
[root@artik log]# ufw logging on
Logging enabled
[root@artik log]# ufw enable
ERROR: problem running ufw-init
iptables-restore: line 43 failed
ip6tables-restore: line 138 failed
ip6tables-restore: line 43 failed
Problem running '/etc/ufw/user.rules'
Problem running '/etc/ufw/before6.rules'
Problem running '/etc/ufw/user6.rules'
Why is it happening ? What should I do to fix it?
Here is how I fixed it
Disable IPV6 in /etc/default/ufw
change IPV6=yes
to IPV6=no
Logs was giving me errors, so I disabled it
ufw logging off
Then I configured the firewall
ufw default allow outgoing
ufw default deny incoming
ufw allow out on tun0
ufw allow in on tun0
ufw enable
Hope it helps others!