Question about Subnetting

kuroteckie

Commendable
Nov 14, 2017
34
0
1,530
Good evening,

While studying up on subnets I've learned that in CIDR notation, depending on the number, that will determine how many hosts you have on your subnet (E.G: If the address looks like 192.xxx.xxx.xxx/24, you will have 8 host parts to work with).

My question is, does the amount of networks/hosts you have depending on the binary number of 1? If you had a /23 CIDR, would the number of hosts jump up to 9?
 
A subnet with /24 notation has 254 hosts (plus network address of 0, and broadcast address of 255) = 256

A subnet of /23 produces 510 hosts (plus 0, plus 255) = 512

For a subnet of 8 hosts, and by 8, I mean total addresses, with 6 usable +network + broadcast, you would use a subnet mask of 255.255.255.248, or /29

The smallest usable mask is 255.255.255.252, with 4 addresses. Two hosts, network, and broadcast (e.g. 192.168.0.0 to 192.168.0.3


Take the following Class C private IP network:

192.168.0.0

Generally, we apply the 255.255.255.0 (or the /24) subnet mask to get 254 hosts (192.168.0.0-192.168.0.255). If we apply the /23 mask, the subnet mask changes to 255.255.254.0 and 510 hosts (192.168.0.0-192.168.1.255)

We could give 192.168.0.0 a subnet mask of 255.255.0.0 (also the default class B subnet mask) or /16 and get 192.168.0.0 to 192.168.255.255, and get the use of 65,534 hosts, but there's little point in most small networks, and indeed the point of subnetting is probably lost in real life applications.

The jumps in the number of hosts do relate to the mask applied, but they jump similarly to the binary bits 'taken' in the subnetting. Again let's look at class C address:

192.168.0.0

255.255.255.0 (/24) = 256 (254 hosts + Nw + Bc) = 192.168.0.0 - 192.168.0.255 (the whole)

255.255.255.128 (/25) = 128 (126 hosts + Nw + Bc) = 192.168.0.0 - 192.168.0.127 (halves)

255.255.255.192 (/26) = 64 (62 hosts + Nw + Bc) = 192.168.0.0 - 192.168.0.63 (quarters)

255.255.255.224 (/27) = 32 (30 hosts + Nw + Bc) = 192.168.0.0 - 192.168.0.31 (eighths)

255.255.255.240 (/28) = 16 (14 hosts + Nw + Bc) = 192.168.0.0 - 192.168.0.15 (sixteenths)

255.255.255.248 (/29) = 8 (6 hosts + Nw + Bc) = 192.168.0.0 - 192.168.0.7 (32nds)

255.255.255.252 (/30) = 4 (2 hosts + Nw + Bc) = 192.168.0.0 - 192.168.0.3 (64ths)

or see the masks in binary form:

11111111.11111111.11111111.00000000 (note the 1s in this adds up to 24 or /24 subnet)
11111111.11111111.11111111.10000000 (this is the 128 bit used, hence the 128, and we have used 25 1s, or /25)
11111111.11111111.11111111.11000000 (also used the 64 bit, so added makes 192, and /26 1s)
11111111.11111111.11111111.11100000 (also used the 32 bit, so added makes 224, and /27 1s)
11111111.11111111.11111111.11110000 (also used the 16 bit, so added makes 240, and /28 1s)
11111111.11111111.11111111.11111000 (also used the 8 bit, so added makes 248, and /29 1s)
11111111.11111111.11111111.11111100 (also used the 4 bit, so added makes 252, and /30 1s)

Having fun yet? :D

Perhaps read the three pages of this (especially page 3) - http://www.9tut.com/subnetting-tutorial

Use a few subnet calcs and get used to the whole /24, /25 and so on. It takes practice. This one is quite good - http://www.davidc.net/sites/default/subnets/subnets.html
 
Keep in mind that it's not common to use less than 24. There are 3 main private ip ranges with available ips. So you can have a great number of unique ones in one organization.

If you need more than 256 ips you would use separate subnets and use routes so they can communicate. You will overload your networking equipment with too many ips on the same layer2. If you have a DMZ or something with just a few statics you would use a mask to limit the available ips to only what you need.

https://en.wikipedia.org/wiki/Private_network