Subnetting
Subnetting is an important factor to consider in any network, especially where public IP addressing is used. This is to ensure that the network blocks are correctly sized for the requirements needed. We use the CIDR notation to denote subnet size, and remember that 2 IP addresses are not usable in the address space (as they are used for network ID and broadcast). For the CCNA, you should be able to work out:
-
First and last usable IP address
-
Network ID
-
Broadcast Address
-
Total number of hosts (and usable hosts)
-
Total number of networks
Subnetting for hosts
IANA (Internet Assigned Numbers Authority) has provided our organisation with the public IP address space of 212.158.39.0/24. The organisation has decided that this address block needs to be subnetted to allow 25 devices per network. We do this by stealing host bits for the network portion of the address. You can use the 2n-2 method (where n is the number of 0 bits). We subtract 2 because one IP address is the broadcast address, and the other one is used as the network ID. The current network block is a /24, so there are 8 total host (or 0) bits, so n becomes 8. 28-2 = 254. You should try to memorise the below table for the exam to work out the number of usable hosts in a network:
Using the above table, we can see that a /27 CIDR can accommodate 30 usable hosts. Therefore we can assign just 5 host bits to the subnet mask by stealing 3 network bits, like below:
Now the subnet mask binary is 11111111.11111111.11111111.11100000, we need to convert the last octet into decimal, so 128+64+32 = 224. The new subnet mask for the /27 address blocks will be 255.255.255.224.
Now we need to work out the specifics for each address block, see below:
Subnet 1 (NETWORK BITS / BORROWED BITS / HOST BITS)
Network ID: 212.158.39.0 (11010100.10011110.00100111.00000000)
First Usable IP Address: 212.158.39.1 (11010100.10011110.00100111.00000001)
Last Usable IP Address: 212.158.39.30 (11010100.10011110.00100111.00011110)
Broadcast IP: 212.158.39.31 (11010100.10011110.00100111.00011111)
Subnet 2 (NETWORK BITS / BORROWED BITS / HOST BITS)
Network ID: 212.158.39.32 (11010100.10011110.00100111.00100000)
First Usable IP Address: 212.158.39.33 (11010100.10011110.00100111.00100001)
Last Usable IP Address: 212.158.39.62 (11010100.10011110.00100111.00111110)
Broadcast IP: 212.158.39.63 (11010100.10011110.00100111.00111111)
Subnet 3 (NETWORK BITS / BORROWED BITS / HOST BITS)
Network ID: 212.158.39.64 (11010100.10011110.00100111.01000000)
First Usable IP Address: 212.158.39.65 (11010100.10011110.00100111.01000001)
Last Usable IP Address: 212.158.39.94 (11010100.10011110.00100111.01011110)
Broadcast IP: 212.158.39.95 (11010100.10011110.00100111.01011111)
Subnet 4 (NETWORK BITS / BORROWED BITS / HOST BITS)
Network ID: 212.158.39.96 (11010100.10011110.00100111.01100000)
First Usable IP Address: 212.158.39.97 (11010100.10011110.00100111.01100001)
Last Usable IP Address: 212.158.39.126 (11010100.10011110.00100111.01111110)
Broadcast IP: 212.158.39.127 (11010100.10011110.00100111.01111111)
Subnet 5 (NETWORK BITS / BORROWED BITS / HOST BITS)
Network ID: 212.158.39.128 (11010100.10011110.00100111.10000000)
First Usable IP Address: 212.158.39.129 (11010100.10011110.00100111.10000001)
Last Usable IP Address: 212.158.39.158 (11010100.10011110.00100111.10011110)
Broadcast IP: 212.158.39.159 (11010100.10011110.00100111.10011111)
Subnet 6 (NETWORK BITS / BORROWED BITS / HOST BITS)
Network ID: 212.158.39.160 (11010100.10011110.00100111.10100000)
First Usable IP Address: 212.158.39.161 (11010100.10011110.00100111.10100001)
Last Usable IP Address: 212.158.39.190 (11010100.10011110.00100111.10111110)
Broadcast IP: 212.158.39.191 (11010100.10011110.00100111.10111111)
Subnet 7 (NETWORK BITS / BORROWED BITS / HOST BITS)
Network ID: 212.158.39.192 (11010100.10011110.00100111.11000000)
First Usable IP Address: 212.158.39.193 (11010100.10011110.00100111.11000001)
Last Usable IP Address: 212.158.39.222 (11010100.10011110.00100111.11011110)
Broadcast IP: 212.158.39.223 (11010100.10011110.00100111.11011111)
Subnet 8 (NETWORK BITS / BORROWED BITS / HOST BITS)
Network ID: 212.158.39.224 (11010100.10011110.00100111.11100000)
First Usable IP Address: 212.158.39.225 (11010100.10011110.00100111.11100001)
Last Usable IP Address: 212.158.39.254 (11010100.10011110.00100111.11111110)
Broadcast IP: 212.158.39.255 (11010100.10011110.00100111.11111111)
Looking at the above, you can see how the maths works for each value:
-
First Usable IP Address: Network ID plus one
-
Last Usable IP Address: Broadcast Address minus one
-
Broadcast Address: Next network ID minus one
-
Network ID: Last network ID plus total number of hosts
We now have 8 subnets, with each allowing 30 usable IP addresses per subnet block.
Subnetting for subnetworks
Following on from the previous example, subnetting to accommodate more/less subnets requires a different calculation. To calculate the number of possible subnets we use the formula 2x (where x is the number of borrowed host bits). Remember that to calculate the of usable hosts we use 2n-2, where n is the number of host bits. Let's see the formula in action.
Our organisation has provided you with the address block 192.168.0.0/16, and requires 10 separate subnetworks for allocation across the estate regardless of the number of possible hosts. In order to work out the new subnet mask we need to use the 2x (where x is number of borrowed host bits). Looking at the below table we can see that by borrowing 4 bits from the host portion, this will give us 16 total subnetworks.
So by borrowing 4 bits from the host portion of the address, the subnet mask becomes 255.255.255.240.
We know it's 255.255.255.240 because this is the total decimal number from the binary bits of the 4 borrowed bits (128+64+32+16=240). Now exactly like subnetting a Class C network we can begin working out the network ID, broadcast address and first/last usable IPs of each subnet. Remember that to calculate each requirement is as below:
-
Network ID: All HOST bits set to 0
-
First Usable IP Address: Last HOST bit set to 1
-
Last Usable IP Address: Last HOST bit set to 0
-
Broadcast Address: All HOST bits set to 1
Subnetting is a complex process that needs practice to become efficient at calculating what is required for the CCNA. I would recommend watching further videos on YouTube and also using practice sites such as the ones below:
https://davidbombal.com/subnet-quiz/
https://subnettingpractice.com/
https://configureterminal.com/davidbombal/quiz/?title=learn-binary-questions-free-exam-questions
https://configureterminal.com/davidbombal/quiz/?title=subnetting-questions-free-exam-questions
Variable Length Subnet Mask (VLSM)
VLSM allows networks administrators to better allocate an available address space dependant on the requirements for the infrastructure. It is especially useful where a public address block is used to maximise the number of networks that can be created from an assigned block. Rather than dividing a network block (say a /24) into fixed subnet sizes, VLSM methodology allows administrators to break that /24 address block into subnets that suit the required number of hosts per network. The practice of subnetting is exactly the same as we have covered however it is important to note that always work from the largest network to the smallest. Let's work through an example.
Looking at the below diagram, we have been given the address block 186.15.152.0/24 to use for the proposed new network. There are 8 total subnets required with 2 of them being the point to point links between the routers.
With VLSM we need to work from the largest network to the smallest, so the first network will be network 4 as it requires 58 usable IP addresses. Referring back to what we know about subnetting the smallest CIDR that can accommodate 58 hosts is a /26, as it allows for 62 usable IP addresses. The next largest network is network 6 which again requires a /26.
It's best to build a table to understand what networks are required, like below:
So now that we have subnetted 186.15.152.0/24 into 8 separate networks, we have optimised the provided block for the requirements of the network design, and we have some space left from the original block to create further smaller networks, or increase the size of any of the created networks should this be required in the future.
Configure and Verify IP Addressing on Cisco Equipment
Please see lab 2 here to explore interface configurations and build a small network. (lab coming soon)