Commands to Troubleshoot Ubuntu UFW

I was having problems with ufw not allowing me to add a new rule.

# ufw deny from to any
ERROR: initcaps
[Errno 2] iptables: Chain already exists.

So this is what I did:

ufw disable
iptables -F
iptables -X
ufw enable

And then I added the rule again

# ufw deny from to any
Rule added

With this command you can list rules by number

ufw status numbered

This is to delete a rule by number, taken from command above

ufw delete 8

Here is to insert a rule at the beginning

ufw insert 1 deny from [ip-to-block] to any




Leave a Reply

Your email address will not be published. Required fields are marked *