Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Our webapp is being hammered by some people in a university in china. They've written a bot that is hitting our signup/signin end points. We've deleted the accounts but we'd really like to cool off the constant hits on those endpoints as well.

Our ubuntu server is configured with ufw and i'd really like to know how i can deny their whole network. I'm going to do this carefully by scanning the logs each day.

I've been looking at the UFW documentation and i'm fairly close to the answer.

sudo ufw deny from <NETWORK/MASK>

Need help in determining the network and mask. Given that I have a.b.c.X as the IP address where X varies from 1 to 255. How do i block this network? Can someone please explain in plain speak how to express the network in a.b.c.0/8 or a.b.c.0/12 /16 etc mean?

I'm not comfortable with fail2ban, so please dont suggest that as an option. I'm keen on deciphering ufw only.

share|improve this question

migrated from Oct 18 '11 at 6:18

This question came from our site for professional and enthusiast programmers.

There are like 50 thousand stackoverflow sub sites. Please be kind enough to move the question across or suggest how to do it. Down-voting the question seems way too harsh. Unless the question itself is invalid or the style of asking the question is not right IMHO. – Aditya Sanghi Oct 18 '11 at 6:11
up vote 3 down vote accepted

I think this question should be on, but here is your answer:

if only X varies you have to specify /24 (CIDR-Notation) or which is the equivalent network mask. (a.b.c.0/24)

Why is that: I think the wikipedia article is a good resource to start with, if you wanna know more about this. Wikipedia-CIDR

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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