1. ## Stupid IP question

Ok, I know some of you guys are gonna think I am nuts but for some reason I can't get this. CIDR. I am trying to write a ruleset for my firewall. If I have an IP that is 192.168.0.0/16 I know it is basically 192.168.*.*, and 192.168.0.0/24 is 192.168.0.* but I don't get the 192.168.0.0/12 or /32 etc subnets. I know the subnet for /22 is 255.255.252.0 but what does that really mean in terms of IP address'?Can someone explain in plain English.

2. ## Re:Stupid IP question

That's fairly simply (although I must admit i'll never get used to that subnet stuff...)
/32, or any number actually means the number of ONEs in octet (each octet has eight ones - 11111111, which means 255 if you'll convert it from binary format to decimal, I use calc in scientific view to do that)
So following that logic 32 is 11111111.11111111.11111111.11111111 - which is 255.255.255.255 - which means host itself, so when you see 192.168.99.55/32 it means that this is the host itself.

/12 using that logic would mean the following:
12 is twelve ones - 11111111.11000000.00000000.000000000,
11111111 - gives us 255
11000000 - gives us 192 (use calc to convert it from binary to decimal format)
000000 - gives us 0
So in the end you get 255.192.0.0

Hopefully I didn't oversimplified that, if I did, then I just tried to be as fothcoming as possible ;D

3. ## Re:Stupid IP question

So, if you want to figure out how many IP's you've covered with a rule like:
IP/16, then it'll be: 2^(32-16)

4. ## Re:Stupid IP question

I am not quite sure that would work.

I know how to do it, but cant say it in a clean fashion (or at least I think its a shitty explanation) but here it goes anyhow.

IIRC the way to do it, is break it into each of the four octets. Turn each octet into how much of a range you have sitting there, and multiply it out.

For example, we know that class C is 192.168.0.xx (to pick one). In a class C we have 255 addresses (1-255 even though 255 is your broadcast and is unusable). So we have a range set of 1,1,1,255. We can multiply that out to 1x1x1x255=255.

If we cut back or expand it this will work. But as said before, I can do it, but its probably the uber-long way. I do know there is a cute little formula, but I forogt it 3 seconds after reading it ;D

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•