Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subnet mask question 1

Status
Not open for further replies.

dinoteo

Technical User
Oct 2, 2003
51
SG
Hello, I encountered a question in 604-801 which i would like to post.
The question is as follow:

A company intends to use class B addressing for its network. The conditions are that it must support 300 minimum subnets and a maximum of 50 hosts. What is the subnet mask?
Choose 2 :

a) 255.255.255.192
b) 255.255.255.128
c) 255.255.255.224
d) 255.255.252.0

Ok, it says it needs a maximum of 50 hosts,so can we use a subnet mask which exceed 50 hosts or use one that doesn't exceed 50 hosts.

Confused.
 
You need 300 subnets and 50 hosts on a class B (255.255.0.0) address

so work it out...

255.255.0.0 = 1 subnet, 65,534 hosts
255.255.255.0 = 256 subnets, 254 hosts each

300 (decimal) = 100101100 (binary) or 9 digits (bits)
50 (decimal) = 110010 (binary) or 6 digits (bits)

Thus either 255.255.255.128 (not generally used by custom or definition?) or 255.255.255.192 would work...


more detail at


to be successful, you'll need to be able to build subnet tables in your head... not by memory, by knowing what they are for...

JTB
Have Certs, Will Travel
"A knight without armour in a [cyber] land."
 
please could you explain in more detail how you got that answer?

Thanks.
 
jtb is correct. I'll see if I can help explain.

Consider this with the bit layout of the last octet of the subnet mask.

128 64 32 16 8 4 2 1
............0
255.255.255.0

Since we are starting with a Class-B network, subnetting it to /24 (255.255.255.0) would give us 256 subnets. That's fewer than 300, so that won't work. That eliminates answer-D.

So...we move the subnet mask bit one space to the right. Remember with binary, every move to the right or left multiplies or divides by 2 your number. It depends upon what you are calculating as to which way you go.

So, we go to the right. We now have.

128 64 32 16 8 4 2 1
............1 0 0 0 0 0 0 0
255.255.255.128

This gives us 512 subnets and 128-2 hosts per subnet.

Let's go one more:

128 64 32 16 8 4 2 1
............1 1 0 0 0 0 0 0
255.255.255.192

This gives us 1024 subnets and 64-2 hosts per subnet.

Let's go one more:

128 64 32 16 8 4 2 1
............1 1 1 0 0 0 0 0
255.255.255.224

This gives us 2048 subnets and only 32-2 hosts per subnet. That's too few hosts according to the question.

So, a /26 (255.255.255.192) would be the most accurate if you are doing the minimum number of hosts.

A /25 (255.255.255.128) would be the most accurate if you are doing the minimum number of subnets.

Both A and B will work. Since the question seems to use the word "host" a lot, I would go with 255.255.255.192.


 
Bah...the spaces in my examples didn't line up properly, but I hope it makes sense.
 
yeah perfect sense cheers :)

I will use your method in future calculations, now that I look at it, its quite simple once you understand.

Thanks!
 
Thanks. I really hope it helps. The air force made me start using binary in 79. I'm glad though. It's helped me since then. That whole 2^n-2 thing makes no sense to me.

Drawing it out during a test really helps me out. I hope it does you too.
 
The easiest way I have found is to start with the default and then borrow the bits:-

Here is an example:-

Default class B = 255.255.0.0
In Binary 11111111.11111111.00000000.00000000
First 2 bytes Network second 2 bytes host.

Start borrowing from the first host bit for networking.

Lets start with borrowing the first 2 bits from the host protion.
Our subnet mask will look as follows:-

Binary = 11111111.11111111.11000000.000000
Normal = 255.255.192.0

If you look at the borrowed switched on bits (2 in this case) and use the 2 to the power off you get the following:-

2 * 2 = 4 - 2 (Cant have all 0's or all 1's) = 2

This means you will have 2 valid subnets (128 and 64).

Now take all the switched OFF bits (14 in all) and do 2 to the power of 14 like so:-

2 then 4 then 8 then 16 then 32 then 64 then 128 then 256 then 512 then 1024 then 2048 then 4096 then 8192 then 16384.

So you will have 16,384 host addresses on each subnet.

Complete the same maths for the next borrowed bit and so on until you get the result you are looking for.

If you use this method and remember it then you should be able to subnet in your head with no problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top