UFW deny ipaddress rule not working

UFW rules have reference numbers and the ruled with lower reference numbers have high priority. Here there should be an allow rule at any place above the deny rule.

So the deny rules should be added first and then the allow rules to overcome this issue.

To resolve the issue here, follow the below steps.

Step1: Check the reference numbers for rules.

#ufw status numbered

Note the reference number for the deny rule that facing issue.

Step2: Remove the deny rule that facing issue.

#ufw delete rule_number

Here rule_number need to be replced with the corresponding value.

Step3: Add the deny rule at the fist place.

#ufw insert 1 deny from IP to any

Here IP need to be replaced with the ipaddress that to be blocked.

That's all…