 You have mainly two options do divide a network address space:

• Divide a network in X amount of subnetworks
• Divide a networks in subnetworks that can fit a determine number of hosts

### But first things first

Given the easy example of the network address 192.168.0.0/24 you need the understand the basics of the address.

192.168.0.0/24 represents a 32 bit address which has 24 bits allocate to identify the networks part of the address and 8 bits (32 bit address – 24 bit network = 8 bit) to identify the host part (given to machines belonging to the same network)

The prefix (/xx) is CIDR (Classless Interdomain  Routing representation of the network mask)

The network mask is represented by a sequence of binary one’s written from left to right.

Example: The conversion from binary to decimal is made by adding the representative value of each position in the binary number that holds a one (1).

Example: The conversion from decimal to binary is made by removing  the representative value of each binary position until you get zero. It is the network’s mask job to determine which part of a given IP address is allocate to address the network and which part is allocate to address a specific host inside that network. The mask is also used to retrieve the network address of any give address which will be the same of all the addresses belonging to the same network. This is done using the AND logical operation.

AND logical operation: Examples:

On the same network (thus machines can communicate with each other without routing) On different networks (need routing to communicate) ### Divide a network in X amount of subnetworks

Given the easy example of the network address 192.168.0.0/24.

The only part of the address you have to work is the host part, thus the last 8 bits in this case. So, you can use part of this bits to address subnetwork reducing the available number of host address in each subnetwork.

Example: This being said, the number of bits you take from the host part is the power of two subnetworks that you create.

1 bit used = 2¹ subnetworks created

2 bit used = 2² subnetworks created

3 bit used = 2³ subnetworks created

So if you need to divide, as an example the address 172.16.64.0/18 into at least 10 subnetwoks how many bits will you have to use?

• 4 bits will be the correct answer. Because 3 would be enough it would create 8 (2³) subnetworks,  and 4 bits will create 16 (2⁴) subnets.

What is the prefix used on the newly created subnetworks?

• This is an easy one.  If we had a 20 bit prefix and we add another 4 bit for subnetting,  the final subnet prefix will /22 (/18+ 4).

What are the network address of each subnetwork?

•  This can be solved with 2 different approaches:

Using binary (going through all the possibility changing one bit at a time)  ### Divide a networks in subnetworks that can fit a determine number of hosts

We need to find how many bits are necessary to bear the number of host required. The number of address is derived from 2 to the power of the number of bits reserved.

The number of host is derived from the number of address minus the 2 addresses (network and broadcast)

So taking the previous example, 172.16.64.0/18, if we need to address the the following subnetworks containing 500, 250, 100 and 3\ hosts. Rule of thumb always start with the largest networks.    