Posts: 1,033
Threads: 85
Joined: Oct 2013
16 Feb 14, 10:04PM
(This post was last modified: 16 Feb 14, 10:08PM by Mousikos.)
So let's say I have a partial IP
A.B.C.X and so I want to block everything from A.B.C.0 to A.B.C.255, in CIDR notation, I would block A.B.C.0/24 to block all of those, regardless of what type of IP it is, correct? And then... from what I gather
24 specifies the number of bits until you don't care right? So if it's 8 instead of 24 you block a hell of a lot of IPs?
Posts: 2,136
Threads: 50
Joined: Jun 2010
16 Feb 14, 10:17PM
(This post was last modified: 16 Feb 14, 10:18PM by jamz.)
(16 Feb 14, 10:04PM)Mousikos Wrote: So let's say I have a partial IP
A.B.C.X and so I want to block everything from A.B.C.0 to A.B.C.255, in CIDR notation, I would block A.B.C.0/24 to block all of those, regardless of what type of IP it is, correct?
Yes, 100% correct.
Quote: And then... from what I gather
24 specifies the number of bits until you don't care right? So if it's 8 instead of 24 you block a hell of a lot of IPs?
Absolutely right.
For those who don't understand the 'bits' part, if you write a dotted decimal IP as binary, it becomes aaaaaaaa.bbbbbbbb.cccccccc.xxxxxxxx, with each letter representing one bit (either a 1 or a 0). Ignoring the first 24 leaves you with just the x's (only 256 hosts max.), and ignoring only the first eight leaves you with 1/256 of the IPv4 address space blocked.
Posts: 562
Threads: 61
Joined: Jul 2010
16 Feb 14, 11:03PM
(This post was last modified: 16 Feb 14, 11:05PM by vonunov.)
Yes. To clarify, the number in CIDR notation is the number of bits in the subnet mask. For example, a /24 indicates a subnet mask of 24 bits; that is:
11111111.11111111.11111111.00000000
Which is to say:
255.255.255.0
Which is to say that the first three octets are taken to indicate the network ID, and the last octet may vary to indicate different hosts. It's a short way of saying "This subnet encompasses x.x.x.0 through x.x.x.255".
Here's a useful chart for seeing how many hosts will be blocked by a range ban using CIDR notation, so you can make sure you aren't banning unreasonably large ranges:
http://bradthemad.org/tech/notes/cidr_subnets.php