We have learned subnetting basics, now lets put these knowledge into practice.
There are 4 common scenarios for subnet
There are 4 common scenarios for subnet
Given a network address and subnet mask, how many subnets can you have and how many hosts per subnet.
Number of Subnet = (2 to the power of number of subnet bits)
In the new Cisco documents, subtracting 2 from the above result is needed under the following conditions:
no ip subnet-zero command appears near the top of the router configuration.
The routing protocol is classful, that is either RIPv1 or IGRP.
Number of Valid Hosts On A Subnet = (2 to the power of the number of host bits) - 2
172 is Class B address,
Default Mask 255.255.0.0 = 11111111 11111111 0000000 00000000
255.255.255.128 = 11111111 11111111 11111111 10000000
The number of subnet bits = 25 - 16 = 9
2 to the 9th power = 512
There are 512 subnet for 184.108.40.206/25 network.
The number of host bits = 7
2 to the 7th power - 2 = 128 -2 = 126
There are 126 valid hosts on a subnet for 220.127.116.11/25 network.
Given network address and needs, provide a subnet mask.
Let's learn by working on an example.
We have network address 172.16.0.0.
Requirements: Subnetting the network 172.16.0.0, so that we have at least 6 subnets, and at least 2000 hosts per subnet.
172 is class B network, default network mask is 255.255.0.0 ( or /16), with 16 network bits, and 16 host bits.
We can subnetting by borrowing some host bits.
3 subnet bits = 8 valid subnets > 6 subnets
So we need to borrow 3 host bits for subnetting, that leave us with 16-3=13 host bits for host portion.
13 host bits gives us 2^13 - 2 = 8190 hosts, which is greater than 2000 hosts. Therefore, our subnetting meet all the requirements.
Conclusion: 172.16.0.0 /19 is the subnet required.
Given network address and subnet mask, list valid subnet addresses.
Let's learn by example.
Given network 172.16.0.0/19, the subnet addresses list is created by increasing the subnet portion from 000 to 111.
Network addr = 10101100 00010000 00000000 00000000
Subnet Mask = 11111111 11111111 11100000 00000000
Network No. = 10101100 00010000 00000000 00000000 (Not Valid)
1st host = 10101100 00010000 00100000 00000000
2nd host = 10101100 00010000 01000000 00000000
3rd host = 10101100 00010000 01100000 00000000
4th host = 10101100 00010000 10000000 00000000
5th host = 10101100 00010000 10100000 00000000
6th host = 10101100 00010000 11000000 00000000
broadcast = 10101100 00010000 11100000 00000000 (Not Valid)
Finally convert the binary to decimal:
1st host = 172.16.32.0
2nd host = 172.16.64.0
3rd host = 172.16.96.0
4th host = 172.16.128.0
5th host = 172.16.160.0
6th host = 172.16.224.0
Given an ip address and subnet mask, find the subnet address, broadcast address and valid host range.
Determining the subnet number of a given IP address:
Given an IP address and subnet mask, finding the subnet address is done by performing a Boolean AND operation. First, the IP address and its subnet mask will be converted to binary, and the subnet address is the Boolean AND results of the IP address and its subnet mask.
Finding the broadcast address is done by setting all the host bits of the IP address to 1, then perform Boolean AND operation with the subnet mask.
To find the range of valid host addresses on a subnet, find the first and last address in the range. The first address in the range is the network number and is not a valid host address; the final address in the range is the broadcast address for that subnet and is not a valid host address. All addresses between the two are valid host addresses.
IP address 18.104.22.168
Subnet mask /28
IP address = 10110010 00101111 00100111 01011001
Subnet Mask= 11111111 11111111 11111111 11110000
Subnet # = 10110010 00101111 00100111 01010000
Subnet Number = 22.214.171.124 /28
1st Address in range: 126.96.36.199 (Network Number, not valid)
Last Address in range:
10110010 00101111 00100111 01011111
=188.8.131.52 (Broadcast Address, not valid)
Valid range of Addresses: 184.108.40.206 - 220.127.116.11