I've come across some web sites that give good tutorials for IP Subnetting:
- About IP Tutorial
- Learn to Subnet on howtosubnet.com
- IP Address Subnetting Tutorial
- IP Address and Subnetting for new users on Cisco.com
Test Question Example:
You have been allocated a 22.214.171.124 IP address for your network. At present we need 13 subnets. In the future we will need to allow for the expansion up to 28 subnets. You need to be able to connect up to 2000 IP addresses available in each subnetwork.
Devise an IP addressing scheme, giving the subnetwork, first host, last host and broadcast IP addresses for each subnet. Also specify the subnet mask you would use.
Use the methodology described next.
You will need to
i. Determine the required number of bits to borrow for subnetting.
ii. Determine the subnet mask
iii. Determine all subnet network addresses
iv. Determine the addresses of the first host, last host and broadcast on each subnet.
You need to include all the calculations and explanations for each item; no marks will be awarded for any unjustified correct answers.
Range: 126.96.36.199 to 188.8.131.52
Now, the others from the calc is:
2 - 184.108.40.206 to 220.127.116.11
3 - 18.104.22.168 to 22.214.171.124
The number of subnets will define how many bits of the IP address you need to use for the network portion of the address, and the number of hosts per subnet will define how many bits of the IP address you need to use for the host portion of the address.
Okay... you're given the Class B address 126.96.36.199. Normally, for a Class B address, 16 bits are used for the network portion and 16 bits are used for the host portion. At present, we need 13 subnets, but we must be prepared for future expansion. Therefore, we should allocate 28 subnets (yes, ignore the 13 subnet part - it's there to make sure you're reading the whole question correctly). That means we need to steal, at a minimum, 5 bits that we would normally use for host addresses and use them for subnets. Why 5 bits? Because 2 to the 5th power is equal to 32 (2 to the 4th power only gives 16 subnets... 2 to the 6th power gives 64 subnets). Even discounting the "all-zeros" and "all-ones" subnets, we still have 30 subnets we can use.
Okay, so how many bits does that leave us for host addresses for each of those subnets? Well, we used to have 16 bits... but we stole 5 for subnets. Is 11 bits enough to handle 2000 IP addresses per subnet? Let's calculate... 2 to the 11th power is 2048 - minus 2 addresses for the network address and broadcast address, and we've got 2046 available IP addresses per subnet. Barely enough!
Back to the subnet portion... how do you get the increase of 8 for each range? Here's how I look at it:
A /16 mask (normal Class B) has 1 big subnet, with an "increase" of 256 per range.
A /17 mask (stealing one bit for subnets) makes 2 subnets (provided you can use the all-zeros and all-ones subnets), with an "increase" of 128 per range.
An /18 mask makes 4 subnets, with an "increase" of 64 per range.
A /19 mask makes 8 subnets, with a 32 increase per range.
A /20 mask makes 16 subnets, with a 16 increase per range.
A /21 mask (stealing 5 bits, which is what you have), makes 32 subnets, with an 8 increase per range. Your calculations are accurate.