I have an apache2.4 webserver, and I am trying to block a malicious subnet using ufw. Here is the UFW setup:

$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing)
New profiles: skip

To                         Action      From
--                         ------      ----
80                         ALLOW IN    Anywhere
Anywhere                   DENY IN     X.X.X.0/24

I to test, I added a rule to block my own IP but I can still view the pages, and site, so evidently, UFW is not blocking traffic from my IP. I can only assume the case is the same for the blocked subnet.

Please, how can I block subnets from accessing my webpages?


(If you're running apache server at port 80). UFW parses the rule in sequential manner, so when the rule matches i.e you allow anyone from anywhere to access your 80 port, as the match is found, you're packet is accepted. It follows the first-match policy.

So now try again and configure it, if problem persist, write a comment below . !

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.