Given a network ID, three relevant parameters remain to understand a subnet. If any one of these parameters is known, the other two can easily be found. The parameters are:
The following information is known:
Network ID: 172.16.0.0
Desired number of hosts/subnet: 4000
1. Determine the class of the network ID. In this case, the network is class B. This
gives a default mask of 255.255.0.0. This also tells us that this network ID has 16
available host bits, yielding a total of 2^16 = 65536 addresses (a), including the broadcast
address and network ID.
2. The actual number of hosts/subnet will be the desired number of hosts/subnet
rounded up to the next power of 2 minus 2. In this case, this will be 4094.
hps = 4094
3. To find the number of subnets:

4. To find the subnet mask, calculate the number of host bits (h):

In binary, this gives us a subnet mask of:

In dotted decimal notation this is: 255.255.240.0
CIDR notation expresses the mask in terms of the number of masked bits (m).
m = 32 - h = 32 - 12 = 20
Therefore CIDR notation will be 172.16.0.0/20.
The following information is known:
Network ID: 172.16.0.0
Desired number of subnets: 13
1. As in example 1, determine the class of the network ID.
2. The actual number of subnets will be the desired number of subnets
rounded up to the next power of 2. In this case, 16.
s = 16
3. Find the subnet mask by determining how many extra maked bits (emb) are required:

The total number of masked bits (m) = the number of masked bits in a Class x address
+ the number of extra masked bits:
m = 16 + 4 = 20
In binary, this gives us a subnet mask of:

Again, in dotted decimal notation this is: 255.255.240.0, and the CIDR notation is 172.16.0.0/20.
4. To find the number of hosts/subnet we need to first determine the number of host bits (h).
h = 32 - m
Or you can just count the number of zeroes in the above subnet mask. Either
method yields h = 12.
Hosts/subnet (hps) can now be found by:

The following information is known:
Network ID: 172.16.0.0
Subnet mask: 255.255.240.0
CIDR: 172.160.0.0/20
1. As in example 1, determine the class of the network ID.
2. To find the number of subnets we need to know the number of masked bits (m). If CIDR notation was given,
we already know the number of masked bits (20 in our example). If the subnet mask was given instead,
the number of masked bits can be determined by just writing the mask in binary and counting the ones:

Once the total number of masked bits is know, we need to find the number of extra masked bits (emb):
emb = m - (Number of masked bits in a Class x address)
emb = 20 - 16
emb = 4
Now we can find the number of subnets (s):

3. To find the number of hosts/subnet we need to first determine the number of host bits (h).
h = 32 - m
h = 32 - 20 = 12
Once the number of hosts bits is known, we can find the number of hosts/subnet (hpn):

After going through any one of the three above examples, we are ready to enumerate the ranges of IP addresses for each subnet. The first IP address in each range will be the network ID for that subnet, and the last IP address in the range will be the broadcast address for that subnet. The first thing that we need to determine is the subnet increment value (i). There are three ways to find this number.
1) Consider the octet value in the subnet mask that is not equal to 255 or 0 in decimal. We will call this value
y. In our example y = 240

i = 256 - y
So in our example i = 16.
2) Another way to find the increment value is to write y in binary: 11110000.
Consider the rightmost masked bit. The decimal value of this bit is the increment value.
Again, we find that for our example i = 16.
3) A final way to determine this value requires that we define a new variable.
z is the number octets in the subnet mask equal to zero. In our example z = 1.
Note that if z = 0, this method does not apply.

Once the subnet increment value is determined, the subnets are enumerated by incrementing the appropriate
octet of the network ID by the increment value. The "appropriate octet" is the octet in the subnet mask that
is not equal to 255 or 0. Here is enumeration of subnet ranges for our example, with the first IP address in
each range being the network ID for that subnet, and the last IP address in the range will be the broadcast
address for that subnet.
| 172.16.0.0 | - | 172.16.15.255 |
| 172.16.16.0 | - | 172.16.31.255 |
| 172.16.32.0 | - | 172.16.47.255 |
| 172.16.48.0 | - | 172.16.63.255 |
| 172.16.64.0 | - | 172.16.79.255 |
| 172.16.80.0 | - | 172.16.95.255 |
| 172.16.96.0 | - | 172.16.111.255 |
| 172.16.112.0 | - | 172.16.127.255 |
| 172.16.128.0 | - | 172.16.143.255 |
| 172.16.144.0 | - | 172.16.159.255 |
| 172.16.160.0 | - | 172.16.175.255 |
| 172.16.176.0 | - | 172.16.191.255 |
| 172.16.192.0 | - | 172.16.207.255 |
| 172.16.208.0 | - | 172.16.223.255 |
| 172.16.224.0 | - | 172.16.239.255 |
| 172.16.240.0 | - | 172.16.255.255 |