Subnets - 172.16.0.0/18 - why 4 subnets

steve_murphysteve_murphy Member Posts: 5 ■□□□□□□□□□
Hi,

I've come across this in the ICND1 CCNA book and can't work out why there are 4 subnets with 172.16.0.0 and 255.255.192.0. I understand there are 16 Network bits (Class B) and there are two subnet bits (x.x.192.0 - prefix /18 ?) but I can't work out why that equates to 4 subnets rather than 2. I see the explanation 2^2 but I don't understand why we multiply the two subnet bits gained in subnet /18 by 2 to get 4.

I'm sure it's quite simple but I'm blinkered and can't see it at the minute.

Cheers
Steve

Comments

  • Rylee1246Rylee1246 Member Posts: 60 ■■■□□□□□□□
    With a /18 you get two extra subnet bits. With those you now have the following 4 ranges that start with
    0
    64
    128
    192

    Each bit has two options, 1 or 0. With two bits your possible options are 00, 11, 10, 01.

    Hence the 4 subnets


    Edit: a /17 would give you a 0 and 128 for your two subnets.

    If you need more explanation, then be specific on what it is and when I am not using my phone to type I will answer the best I can.
  • steve_murphysteve_murphy Member Posts: 5 ■□□□□□□□□□
    Thanks Rylee !

    It is purely learning at the moment - trying to get my head around the concept. So am I right in thinking the 4 subnets would be 172.16.0.x, 172.16.64.x, 172.16.128.x and 172.16.192.x where "x" would be hosts 1 to 254 ? I think I get why 2^2 now - that's the 4 options 00, 11, 10, 01 you mention. /19 would give 8 subnets 2^2^2 and the possible combination of binary options ?
  • rob42rob42 Member Posts: 423
    You're nearly there, but not quite...

    With a /18 mask (255.255.192.0) the 'network' address uses not only the first two Octets, but also the two most significant bits of the 3rd Octet, while the 'hosts' are addressed by the remaining 6 bits of the 3rd Octet plus all 8 bits of the 4th Octet.

    In order to 'see' what's going on, for me, I like to map out the binary (host bits are in red)...
    IP Address.. 1 0 1 0 1 1 0 0 | 0 0 0 1 0 0 0 0 | 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 0 = 172.16.0.0
    Mask........ 1 1 1 1 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 [COLOR=#ff0000]0 0 0 0 0 0[/COLOR] | [COLOR=#ff0000]0 0 0 0 0 0 0 0[/COLOR] = 255.255.192.0
    'AND'....... 1 0 1 0 1 1 0 0 | 0 0 0 1 0 0 0 0 | 0 0 [COLOR=#ff0000]0 0 0 0 0 0[/COLOR] | [COLOR=#ff0000]0 0 0 0 0 0 0 0[/COLOR] = 172.16.0.0
    

    If we 'set' all the 'host bits' (to reveal the 'broadcast' for Subnet 172.16.0.0) we get...
    IP Address.. 1 0 1 0 1 1 0 0 | 0 0 0 1 0 0 0 0 | 0 0 1 1 1 1 1 1 | 1 1 1 1 1 1 1 1 = 172.16.63.255
    Mask........ 1 1 1 1 1 1 1 1 | 1 1 1 1 1 1 1 1 | 1 1 [COLOR=#ff0000]0 0 0 0 0 0[/COLOR] | [COLOR=#ff0000]0 0 0 0 0 0 0 0[/COLOR] = 255.255.192.0
    'AND'....... 1 0 1 0 1 1 0 0 | 0 0 0 1 0 0 0 0 | 0 0 [COLOR=#ff0000]0 0 0 0 0 0[/COLOR] | [COLOR=#ff0000]0 0 0 0 0 0 0 0[/COLOR] = 172.16.0.0
    

    So the 'host' range is x.x.0.1 to x.x.63.254. The next IP Address (the one after the Broadcast) would be x.x.64.0; the 2nd Subnet.

    I hope this is of help.
    No longer an active member
  • Rylee1246Rylee1246 Member Posts: 60 ■■■□□□□□□□
    That is correct. Just remember you also have to eliminate a couple for each subnet. So your useable ranges would be

    1 to 62
    65 to 126
    129 to 190
    193 to 254

    I am pretty sure I got those right but I'm not 100% awake right now so if someone sees this and knows I'm wrong correct me. :)

    Edit: and like I said I am not paying attention haha. You have more than 1 octet of hosts. My numbers above are for 1 octet....the guy above is correct. Just make sure to account for each beginning and end of the range that you eliminate as not useable.
  • steve_murphysteve_murphy Member Posts: 5 ■□□□□□□□□□
    Thanks Rob - yes, I find the binary mapping does help - I've been looking at Subnet IDs and useable IP address ranges today and it does help doing the longhand binary. Looking to see if I can find help online with learning to speed up the conversion from binary to DDN - practise, practise, practise ...

    Thanks !
  • rob42rob42 Member Posts: 423
    Thanks Rob - yes, I find the binary mapping does help - I've been looking at Subnet IDs and useable IP address ranges today and it does help doing the longhand binary. Looking to see if I can find help online with learning to speed up the conversion from binary to DDN - practise, practise, practise ...

    Thanks !

    You're very welcome.

    RE: BIN>DEC/DEC>BIN conversions: I use a Casio fx-115 Scientific Calculator (it's maybe 25 to 30 years old and gives my age away :D) and I find it invaluable! I've a couple of apps on my phone (Android) also, but I love old calc'.
    No longer an active member
  • steve_murphysteve_murphy Member Posts: 5 ■□□□□□□□□□
    That makes a lot of sense - it didn't sink in this morning that the useable ranges would be the whole of the 14 host bits - I kind of had it in my head the x.x.0.1-254 was subnet 1 - then x.x.64.1-254 was subnet 2. But the 14 host bits allow for many more hosts. Thanks for your help guys!
  • wseyllerwseyller Member Posts: 44 ■■■□□□□□□□
    Here is how I look at it.

    subnet mask is /18 so the interesting octet (the one you care about) is the 3rd octet.

    Remember the power of 2s for the 8 bits per octet: 128 64 32 16 8 4 2 1

    Number of bits for first two octets is 16. So the third octet will have two bits which include 128 and 64 going left to right. 128 + 64 = 192 which is where the 192 in the subnet mask comes from.

    The value 64 is in the bit position for the 18th bit in the 3rd octet.

    The value of 64 is your magic number

    The third octet will increment by a value of 64 because it is your magic number.

    0 to 63
    64 to 127
    128 to 191
    192 to 255
  • steve_murphysteve_murphy Member Posts: 5 ■□□□□□□□□□
    Thank you wseyller ! The more I read about it the more it makes sense - the magic number being very important - I've done a bunch of practice examples over the last 24/48hrs and it's making sense now. Thanks for the explanation !
Sign In or Register to comment.