Continuing From The Last Page...
Let’s give an example of subnetting:
Let’s say our network address we are going to work with is 126.96.36.199. This is a class C IP address, and Class C addresses have a default subnet mask of 255.255.255.0. And lets suppose we need 12 subnets for our networks. The nearest power of 2 is 16, which = 2 to the 4th power.
Now we need to borrow 4 bits from the host portion to add to our network portion of the subnet mask. Our default subnet mask was 255.255.255.0, but we added 4 bits to the end of our subnet, so we now have 11110000. Why 8 bits? Because, there are8 bits per octet in an IPV4 address, and you will always borrow bits from left to right. It’s best to envision all 8 bits when calculating their values. We have 4 bits with the values: 1x2 to the 4th power = 16, + 1x2 to the 5th power = 32, + 1x2 to the 6th power = 64, + 1x2 to the 7th power = 128. So we have 16 + 32 + 64 + 128 = 240. So our new subnet mask equals 255.255.255.240.
Now we need to calculate how many host addresses we will have per subnet. We do this using the bits within the host portions octet that were not assigned to the network portion. We assigned 4 bits to the network portion, leaving us with 4 bits for host addresses. 2 to the 4th power = 16. Remember, the formula to figure out how many host addresses are available is 2 to the nth power – 2 (with N representing the number of bits you have left over in the octet). So we effectively have 2 to the 4th power – 2 which equals 16 – 2, which = 14 host addresses per subnet.
Now we need to figure out the numbers for our subnet addresses. We can do this by cycling through the 4 bits that we added to our subnet mask. Our first address we started with was 188.8.131.52, and this is where we will start. Remember, there is always 8 bits in an octet. The diagram below shows how we cycle through those 4 bits using the original IP address we started with:
195.40.10.00000000 (subnet address = 184.108.40.206)
195.40.10.00010000 (subnet address = 220.127.116.11)
195.40.10.00100000 (subnet address = 18.104.22.168)
195.40.10.00110000 (subnet address = 22.214.171.124)
195.40.10.01000000 (subnet address = 126.96.36.199)
195.40.10.01010000 (subnet address = 188.8.131.52)
195.40.10.01100000 (subnet address = 184.108.40.206)
195.40.10.01110000 (subnet address = 220.127.116.11)
18.104.22.16800000 (subnet address = 22.214.171.124)
126.96.36.19910000 (subnet address = 188.8.131.52)
184.108.40.20600000 (subnet address = 220.127.116.11)
18.104.22.16810000 (subnet address = 22.214.171.124)
126.96.36.19900000 (subnet address = 188.8.131.52)
184.108.40.20610000 (subnet address = 220.127.116.11)
18.104.22.16800000 (subnet address = 22.214.171.124)
You may now notice that we have 16 subnets, and we only needed 12, so the calculation worked for us. We also calculated that there are 16 addresses available per subnet. Remember our formula to figure the available host addresses? It was 2 to the nth power – 2. This was because you cannot use the host addresses that end in all ones (this is the broadcast address), or all zeros (this is the network address). EX: Looking back at our first subnet of 195.40.10.00000000 (subnet address = 126.96.36.199), there are 16 available addresses, but the first address of 195.40.10.00000000 (ones included for visual comprehension), or 188.8.131.52, would be the address assigned to our router. This would be our network address, therefore you could not assign this address to a host (computer) on the network. You also cannot assign the last address, which would be the broadcast address. Our full range of addresses available per subnet is 16, and so for the subnet numbered 184.108.40.20610000 (subnet address = 220.127.116.11), our affective addresses would be from 18.104.22.168 to 22.214.171.124. Actually, the first address of each subnet is typically going to be the address of your network, so it cannot be assigned to hosts. Just like the hosts on a network require an IP address in order to communicate with other hosts or networks, so do routers. Most routers use DHCP (Dynamic Host Configuration Protocol) to assign hosts on a given network with an IP address. Routers that use this protocol typically start with a class C private IP address and assign the first address to the router, and the other addresses are assigned IP addresses extending from the routers IP address. When we refer to “host”, we are referring to any device, not just a computer that is assigned an IP address. This could be a smart phone, desktop or laptop PC, tablet PC, printer, or any other mobile device on your network.