Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I already block some simple ip lighttpd but I want to block a whole network. I've problem to understand what is this network address for example 10.0.0.0/8 and/or 172.16.2.0/24 network? What is this /8 or /24 means? I use $HTTP["remoteip"] to add my ip I want to deny the access.

share|improve this question

1 Answer 1

The numbers after the slashes are subnet prefixes in CIDR notation (they're just another way to express subnet masks). Subnets and CIDR are a pretty fundamental concept in IP networking and you won't avoid learning how they work.

10.0.0.0/8 denotes all addresses from 10.0.0.0 to 10.255.255.255. (the most significant 8 bits are specified, the rest can be anything)

172.16.2.0/24 denotes all addresses from 172.16.2.0 to 172.16.2.255.

It even works with numbers that aren't multiples of eight: 172.16.2.0/28 means 172.16.2.0 to 172.16.2.16. If you're not comfortable doing bit manipulations in your head, there are numerous calculators for this sort of stuff. netmask is a very useful CLI tool, and you can also find many web-based ones if you search for them. With netmask, if you want to block addresses 10.11.12.13 to 10.11.12.31, you can say

netmask -c 10.11.12.13:10.11.12.31

and you'll get the best subnets that describe the range (there will likely be more than one, and they all have to be specified to describe the range).

If you just want to specify one address, you either leave out the /n, or specify /32. Which one is acceptable/preferred depends on the software that's parsing it.

share|improve this answer

Your Answer

 
discard

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.