Subnetting: Detrmining Subnet Mask based on Desired Hosts?

KikodeKikode Posts: 74Member ■■□□□□□□□□
Hello,
Just finished the Subnetting section on CBT nuggets. Started searching for more subnetting exercises online and found a great practice sheet. However the practice work Im doing now Gives me the Class of the network (A,B,C) and wants me to determine the best subnet mask to use based on the desired amount of subnets.

The first question is if you have a Class A network and wish to have 50 subnets what should the subnet be if you want the most hosts per network as possible. The answer is already goven as 255.252.0.0 however it doesn't explain the math process to get to this number and I'm curious how to do it. If any of you subnetting Gurus know more about this please help.

Thanks.

Comments

  • bighornsheepbighornsheep Posts: 1,506Member
    Remember these numbers:

    128 (1 additional bit)
    192 (2 additional bits)
    224 (3 additional bits)
    240 (4 additional bits)
    248 (5 additional bits)
    252 (6 additional bits)
    254 (7 additional bits)
    255 (8 additional bits)

    Class A subnet mask is 255.0.0.0 (8bits); when subnetted to 255.252.0.0, you are adding 6 bits to be used for additional subnets, 2^6 = 64, this meets the requirements for 50 subnets, 5 bits (.248 ) won't work because 2^5 = 32 which is <50.

    Also, you should know that IPv4 addresses are 32 bits, so 32-8-6=18 bits are available for addressing the hosts within each subnets. In other words, 255.252.0.0 will support 64 subnets each with 2^18 - 2 host addresses (You need to subtract 2 because of the network/broadcast addresses)
    Jack of all trades, master of none
  • DevilsbaneDevilsbane Posts: 4,212Member ■■■■■■■■□□
    Just a warning here. I don't think the method that James Conrad uses in the video is 100% accurate. When I watched it just didn't make sense how it would work, so I asked around and received a response that it only works some of the time. (And for me, some of the time isn't good enough. So I take a longer, but more accurate approach)

    To answer your question...
    A class A address defaults to a 255.0.0.0 mask. The question is asking you to divide it so there is exactly 50 subnets. It doesn't say this directly, but if you divided it into 51 or more subnets, then you would no longer to have the maximum hosts possible.

    2^x=50 is the equation that you need.
    2^1=2 (not enough)
    2^2=4 (not enough)
    2^3=8 (not enough)
    2^4=16 (not enough)
    2^5=32 (not enough)
    2^6=64 (more than enough, we only needed 50 subnet, but we are going to get 64)

    So we must give 6 more bits to the network address.
    Default mask: 11111111.00000000.00000000.00000000
    New mask: 11111111.11111100.00000000.00000000
    Convert the new mask into decimal, and you have 255.252.0.0
    Decide what to be and go be it.
  • DevilsbaneDevilsbane Posts: 4,212Member ■■■■■■■■□□
    Devilsbane wrote: »
    2^x=50 is the equation that you need.

    I should say that 2^x >= 50 is the equation that you are looking for. The reason being, if your boss asks for 50 subnets, and you give him 32, there is going to be trouble. If he asks for 50, and you give him 64, then you have an extra 14 subnets for if your company expands.

    And yes, you could have borrowed 7 bits, and given him 128 subnets. But now you don't have the maximum number of hosts per subnet. As number of subnets increases, the number of potential hosts goes down. As the number of subnets decreases, the number of potential hosts go up.
    Decide what to be and go be it.
  • KikodeKikode Posts: 74Member ■■□□□□□□□□
    Hey thanks for the Help and additional info. Devilsbane I tried your method out on the remianing problems and it works perfectly. There was one that it didn't work on and I'm guessing that it was a typo. The question reads You have a class B network with 4 desired subnets. I come up with 255.255.192.0 but it says the answer is 255.255.224.0 Am I already smarter then the Questions or am I missing something? 2^2 = 4 right? And 2 Bits to the right equals 11111111.11111111.11000000.00000000 = 255.255.192.0

    I just remembered something I heard in the video. From 1995 and prior you had to subtract -2 from the subnets because of the routers. Perhaps this Question sheet wanted me to subtract two and therfore I would have had to go with 2^3=8 which would in fact give me 255.255.224.0
  • DevilsbaneDevilsbane Posts: 4,212Member ■■■■■■■■□□
    Kikode wrote: »
    I just remembered something I heard in the video. From 1995 and prior you had to subtract -2 from the subnets because of the routers. Perhaps this Question sheet wanted me to subtract two and therfore I would have had to go with 2^3=8 which would in fact give me 255.255.224.0

    There is probably the issue.

    For me, I subtract 2 if I am given the number of hosts. But do not subtract 2 if given the number of subnets. You do not need to lose 2 subnets, but you will lose 2 possible addresses because of the network address and the broadcast address.

    Just remember, that when a bit in the mask is a 1, it is used for the network and when it is a 0, it is used for the host. So when you are working on a problem that says you have a class B address and need to have 500 hosts per subnet you do the following.

    2^x-2=500
    2^x=502
    x=9
    Since you are working with hosts, this means that you need to have at least 9 0's.

    So your mask could be anything from 255.255.0.0 to 255.255.254.0, but there will likely be a second part of the question to determine what the answer is, such as "while having the most number of subnets." (which would make the answer 255.255.254.0)

    Just a note, I usually use shorthand to write subnet masks. 255.255.255.0 is the same as 11111111.11111111.11111111.00000000 but I will only usually write out the binary for the octet that the change occurs in. So for your initial problem, I would use something like 255.11111100.0.0 just to save time and space. I will only convert to full binary when I am finished with the problem. I'm not fluent enough with subnetting to look at 224 and instantly know that it is 11100000 so I work it out and write it down. If my way doesn't make sense to you, don't use it. There are a thousand ways to subnet, pick the one that works for you.
    Decide what to be and go be it.
  • KikodeKikode Posts: 74Member ■■□□□□□□□□
    Well there in lies the issue CBT didn't cover this scenario which is why I'm glad I searched for practice questions. His method of finding hosts is the same as yours though because you have to account for the Router interface and the network ID. I am a little concerned if his method is flawed as you mentioned because in a real world scenario you really don't want to screw up and not have enough subnets or hosts when the network expands. I actually Admin a 2003 server (File Print/Server for the Office) at my job but never have actually needed to do subnetting in a work enviroment yet. I'm like a Baby Admin but smart enough to know to learn what I can before I need to use it. hehe Thanks again for the formula. Cheers!
Sign In or Register to comment.