Finding Specific Range Quickly in Subnetting

/usr/home

Supreme [H]ardness
Joined
Mar 18, 2008
Messages
6,160
I've been studying here for my CCENT (booked it for mid-April) and have been tackling subnetting and have a fairly good grip on it now. One thing I have problems with is quickly figuring out "Find the x range of ip address /mask"

Say I have 10.150.18.34 \27.

Our subnet is 255.255.255.224 and our increment is 32. We also have 2^19 subnets which is 524,288. I'm asked find network id and broadcast id for the 35,214th range. What's an easy way to figure that out? If it was like the 15th range I'd have no problem. Any tips?
 
Here is what I do
Memorize this
128 , 64 , 32 , 16 , 8 , 4 , 2 , 1

Know a /24 is 254 hosts with a network of 0 and a broadcast of 255.

The rest you can build in your head.
a /24 is (1) /24
a /23 is (2) /24's
a /22 is (4) /24's
a /21 is (8) /24's
and so on

Then, for the netmask.. if you are using a /21 do the following
a /24 is 255.255.255.0
In binary that is
11111111.11111111.11111111.00000000
(8 1's dot 8 1's dot 8 1's dot 8 zero's)
So the netmask for a /21 is
8 + 8 + 5
So you need 5 1's. Look at the chart above
128+64+32+16+8 = 248
So your netmask is 255.255.248.0

Then just work backwards for /25, /26, /27 etc.
If you memorize a /24 and the table above you can build the entire CIDR in your head.
 
first, if they are giving you this question in a book or something, it's completely unrealistic. I've never heard of any situation in which knowing this would be useful.

that said, i'm assuming that all of your subnets are /27, correct? if so, that means you have 8 different possibilities for the last octet (.0, .32, .64, .96, .128, .160, .192, .224).

from that you can see that 35214 % 8 = 6, so if i'm thinking correctly, your last octet would be .192 for network id and .223 for broadcast.

then, for the first 3 octets... if you have 2^19 subnets, that means you have the /8 (27 - 19 = 8).

so, 35214 / 8 = 4401.75, so we already took care of the .75, so you want the 4401st /24 subnet. if you mod that by 255, you get 66, so the 3rd octet is 66. what's left is 4401 / 255, which is 17 and change. that should mean that the 2nd octet is 17.

so, the network id would be 10.17.66.192 and broadcast would be 10.17.66.223


disclaimer: i'm tired, so I don't claim that what I just said is 100% correct, but that's the logic i'd use to figure it out. hopefully you can use a calculator.
 
first, if they are giving you this question in a book or something, it's completely unrealistic. I've never heard of any situation in which knowing this would be useful.

that said, i'm assuming that all of your subnets are /27, correct? if so, that means you have 8 different possibilities for the last octet (.0, .32, .64, .96, .128, .160, .192, .224).

from that you can see that 35214 % 8 = 6, so if i'm thinking correctly, your last octet would be .192 for network id and .223 for broadcast.

then, for the first 3 octets... if you have 2^19 subnets, that means you have the /8 (27 - 19 = 8).

so, 35214 / 8 = 4401.75, so we already took care of the .75, so you want the 4401st /24 subnet. if you mod that by 255, you get 66, so the 3rd octet is 66. what's left is 4401 / 255, which is 17 and change. that should mean that the 2nd octet is 17.

so, the network id would be 10.17.66.192 and broadcast would be 10.17.66.223


disclaimer: i'm tired, so I don't claim that what I just said is 100% correct, but that's the logic i'd use to figure it out. hopefully you can use a calculator.

No you can't :(. I agree it's completely unrealistic. It was just a practice question that I had. There was one with 2,000,000 subnets with 6 hosts each. If you were to ever even use that, you'd have a calculator to help you anyways so yeah...
 
I just noticed this on my DSL Gateway.



Internet Address:

216.197.xxx.xxx

Subnet Mask:

255.255.254.0

Default Gateway:

216.197.xxx.xxx

How can a class C network have a /23 Gateway?
 
The gateway is in a different IP range. To do classless you would have to own a block of subsequent IPs then? Sorry for the noob questions.

So instead of having a Class B IP address (which the ISP probably couldn't get) they got multiple subsequent Class C addresses and just went up to /23 to get 510 address off that range?
 
Last edited:
The gateway is in a different IP range. To do classless you would have to own a block of subsequent IPs then? Sorry for the noob questions.

So instead of having a Class B IP address (which the ISP probably couldn't get) they got multiple subsequent Class C addresses and just went up to /23 to get 510 address off that range?

It's not possible for your gateway to be in a different IP range.

216.197.XXX.XXX so is NAT'ed behind your public address. In this case, we don't care about class. You can even NAT public IP ranges such as 128.XXX.XXX.XXX with any subnet mask if you like.
 
Last edited:
My gateway is 201.197.152.x whereas my IP is in 201.197.153.x. Subnet mask is /23.

Only 192.168.0.0-192.168.255.255 is private. The rest are public to 223. What I have is a 2wire DMZ'ed (because bridge is disabled on here) to my router.

So basically my ISP was given say 201.197.150.0 - 201.197.160.0 for example. Instead of being limited to 10 groups of 254 addresses, they went with say 5 groups of 510 address?
 
Last edited:
Ah OK, I think I got it figured out. My ISP was given the block 216.197.128.0/17 and they then further subnetted it down to 216.197.128.0/23 giving them 64 subnets and 510 hosts per subnet.

So basically they treated the 216.197.128.0. like a Class B and subnetted it from there. I assumed since it was a Class B that it had to be a /24 or higher subnet mask.

So is having classes of IP addresses used only for finding the default subnet? When you say class A, basically all you mean is that the default subnet mask is 255.0.0.0 and for B the default mask is 255.255.0.0. but that DOES NOT MEAN YOU ARE LIMITED to not using a /3 or /4 on a "B address?" I'm just having a bit of trouble when ti comes to classes trying to not think of them as being strict and not allowing other subnet masks.

I really hope what I am saying makes sense. Maybe I'm having a subnetting epiphany :p.
 
Last edited:
Ah OK, I think I got it figured out. My ISP was given the block 216.197.128.0/17 and they then further subnetted it down to 216.197.128.0/23 giving them 64 subnets and 510 hosts per subnet.

So basically they treated the 216.197.128.0. like a Class B and subnetted it from there. I assumed since it was a Class B that it had to be a /24 or higher subnet mask.

So is having classes of IP addresses used only for finding the default subnet? When you say class A, basically all you mean is that the default subnet mask is 255.0.0.0 and for B the default mask is 255.255.0.0. but that DOES NOT MEAN YOU ARE LIMITED to not using a /3 or /4 on a "B address?" I'm just having a bit of trouble when ti comes to classes trying to not think of them as being strict and not allowing other subnet masks.

I really hope what I am saying makes sense. Maybe I'm having a subnetting epiphany :p.

I edited my previous post to correct the mistake regarding the private IP addresses.

Again, this is classless routing. You can put any mask with any address you want. If you want to use an IP range of 10.XXX.XXX.XXX with a mask of 255.255.255.0 or if you want to use 192.168.0.0 with a mask of 255.0.0.0, then you can. That's the concept behind CIDR, or Classless Inter-Domain Routing.
 
My mind was just getting stuck on the "classes" and immediately assuming you are stuck between certain subnets. I'm not sure why either... The only thing the class of the IP tells you is basically the default subnet mask.
 
Not even that anymore. Classful networking is a thing of the past (unless you forget to shut it off on whatever protocol you are playing with).
 
I think by "default subnet mask" he meant that's what Windows will auto-fill in the mask when you static an IP.

and yeah, classes don't mean jack anymore.
 
I meant that a Class A address by default has a 255.0.0.0. mask, a Class B a /16 mask and a Class C a /24. I was thinking that a Class C HAD to be /24-/30, a Class B HAD to be /16-/30, and a Class A HAD to be /8-/30. I never thought of being able to "go up the mask". Things make a lot more sense this way :D
 
Back
Top