Subnetting.. how to solve "what subnet mask to use get xxxx subnets" question

SurferdudeHBSurferdudeHB Member Posts: 199 ■■■□□□□□□□
Can someone please show me a effective way to resolve these type of subnetting problems, thank you.

What subnet mask would you use for the 172.18.0.0 network, such that you can get 600 subnets and 40 hosts per subnet?

Comments

  • ShdwmageShdwmage Member Posts: 374
    I am terrible, I actually write it out and do the math.


    128 64 32 16 8 4 2 1

    You are looking for the total hosts to be at least 40, but as close as possible.

    1 + 2 + 4 + 8 + 16 = 32 - 2 = 30 Not enough

    1 + 2 + 4 + 8 + 16 + 32 = 63 - 2 = 61 As Close as you are going to get

    128+64 = 192
    So in your example the subnet would be 255.255.255.192

    I hope that helps.
    --
    “Hey! Listen!” ~ Navi
    2013: [x] MCTS 70-680
    2014: [x] 22-801 [x] 22-802 [x] CIW Web Foundation Associate
    2015 Goals: [] 70-410
  • whizzerwhizzer Member Posts: 17 ■□□□□□□□□□
    Can someone please show me a effective way to resolve these type of subnetting problems, thank you.

    What subnet mask would you use for the 172.18.0.0 network, such that you can get 600 subnets and 40 hosts per subnet?

    There's some good threads here about that. IE http://www.techexams.net/forums/ccna-ccent/38772-subnetting-made-easy.html

    Personally, I think the most important thing is knowing your powers of 2 inside and out. Once you remember 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, etc, answering these questions is easier. The next concept is block size, I.E. how many things can fit in X. Due to the powers of 2 and binary, you can only have blocks, chunks, groups, etc in the sizes of the powers of 2.

    So in your example, 40 hosts would need a block size of 64. 40 fits between 32 and 64, 32 would be too small (duh). Of course, subtract 2 hosts or IPs, 1 for network and 1 for broadcast, 30 > 40 < 62, 40 still fits. Now for the mask, subtract block size from 256, 256 - 64 = 192. 255.255.255.192 or for CIDR subtract the 2 power exponent from 32 (2^6=64), /32 - 6 = /26
  • SurferdudeHBSurferdudeHB Member Posts: 199 ■■■□□□□□□□
    Thank you both :)
  • SurferdudeHBSurferdudeHB Member Posts: 199 ■■■□□□□□□□
    Ok sorry, one more.

    What subnet mask would you use for the 172.19.0.0 network, such that you can get 90 subnets and 350 hosts per subnet?

    THis one is a bit tough since it's asking for 350 hosts..
  • whizzerwhizzer Member Posts: 17 ■□□□□□□□□□
    Easy, 256 < 350 > 512. Again, powers of 2. So the trick here is, you've moved into the third octet, because you're dealing with 9 bits. 2^9=512.

    For me, I throw away the forth octet and just work on the third. If you subtract the bits used for the forth octet (icon_cool.gif, the remainder becomes the new factor. 9 - 8 = 1

    Now back to powers of 2, 2^1=2, block size = 2, subtract block size from 256, 256-2=254

    Mask = 255.255.254.0
  • xnxxnx Member Posts: 464 ■■■□□□□□□□
    My way of doing the above..

    'Class B' Address to start so 16 bits are already used for the network, you have 16 bits left to play with

    2^7 = 128 (closest number to 90 subnets), left side is for network so add 16 + 7 = 23 bits for subnet mask

    Subnet Mask = 255.255.254.0
    Getting There ...

    Lab Equipment: Using Cisco CSRs and 4 Switches currently
  • eSenpaieSenpai Member Posts: 65 ■■□□□□□□□□
    Ok sorry, one more.

    What subnet mask would you use for the 172.19.0.0 network, such that you can get 90 subnets and 350 hosts per subnet?

    THis one is a bit tough since it's asking for 350 hosts..

    The largest single subnet you can have with standard addressing is 254 addresses (256-2) before you need to start stealing bits. Since you need 350, you immediately know that you have to steal a bit from the network. Thus if 255.255.255.0 (/24) yields 256 addresses(254 usable) then 255.255.254.0 (/23) will yield double that @ 512 addresses with 510 usable. Similarly a /22 (255.255.252.0) will yield 1022 addresses with 1020 usable.

    These are all powers of two and could have been calculated by knowing the number of bits needed and raising 2 to that power.
    11111111 11111111 11111111 00000000 is 255.255.255.0 which is in turn a /24. The subnet mask tells which of these bits should be on or off. Therefore the 11111111 11111111 11111110 00000000 , or a /23 ,subnet mask tells us to steal a bit from the network and add it to the hosts. Count up the zeros and raise 2 to that power/ There are 9 zeroes so 2^9 = 512 hosts of which 510 are useable.

    Or memorize how many addresses are available in a 255.0.0.0., 255.255.0.0, 255.255.255.0 and understand your number needs to fall in, or out, of those ranges. For example if you need 120 addresses then that is less than the number provided by 255.255.255.0 (or 254 usable addresses) so you immediately know that you are subnetting (stealing bits) in the last octet. Now 2 raised to the what gets you closest to 120???
    That would be 2^7 since we stole one bit from hosts and added it to the network leaving us only 7 hosts bits which equals 128. This is your block size and ALSO your subnet. Thus your mask is
    255.255.255.128 or 11111111 11111111 11111111 10000000.
    Count up the ones present for your /X addressing or simply add the stolen bit to the previous 24 for a /25 result.

    This kind of question gets better with practice and it helps to understand the math behind the problem since you can always back into the right answer.
    Working On:
    2018 - ITIL(SO, SS, SD, ST, CSI), Linux
    2019 - ITIL MALC, AWS Architect, CCSP, LPI-2, TOGAF
Sign In or Register to comment.