You are given a class A network 10.0.0.0/8 (the /8 is known as the classful prefix length of class A network). However, you have 4 VLANs so you need to have 4 different networks, each for the 4 VLANs. Getting more networks is not an option so you figure out that you need to do subnetting. Just how will it looks like after subnetting?

Two simple rules to remember:

Number of subnets available depends on the number of bits borrowed from the host ID. In this case, we need 4 subnets so we need to borrow 2 bits from the host ID (2^{2} = 4).

Number of hosts per subnet depends on the number of bits not borrowed from the host ID. In this case, there are 22 bits remains in the host ID. Therefore, per subnet can have 2^{22} – 2 = 4,194,302 hosts. We need to minus 2 because one address is reserved as the network address (e.g. 10.0.0.0, 10.64.0.0, 10.128.0.0, 10.192.0.0) and one address is reserved as the broadcast address (e.g. 10.63.255.255, 10.127.255.255, 10.191.255.255, 10.255.255.255).

Another example using a class B network 172.18.0.0/16. We need 100 subnets and maximizes the number of host addresses for each subnet.

So we need to find out how many bits is needed to have 100 subnets. If we choose 6 bits, we only get 64 subnets so we try 7. 7 bits will give us 128 subnets so we will need to borrow 7 bits from the host ID.

What will be the new subnet mask? Since we have borrowed 7 bits, the new prefix length will be /23 (8+8+7) and the subnet mask will be 255.255.254.0. If you look at the table below, treat each column as 1 bit and start adding from left to right, you will get 254 (128+64+32+16+8+4+2). In this case, it will be faster if you just take 255-1.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

2^{7} | 2^{6} | 2^{5} | 2^{4} | 2^{3} | 2^{2} | 2^{1} | 2^{0} |

What will be the first 5 subnets? The first 5 subnets will be 172.18.0.0, 172.18.2.0, 172.18.4.0, 172.18.6.0 and 172.18.8.0. You can use the table below to verify. Bits in red are those borrowed for subnetting. One trick to do this faster is to take the remaining number of bits left over in the octet where the host bits have been borrowed and do a power of 2 to that number. In this case, the remaining number of bits in the 3rd octet is one and 2^{1} = 2. Therefore, each subnet increases by 2.

Subnets | Binary form |

172.18.0.0 | 1010 1100.0001 0010.0000 0000.0000 0000 |

172.18.2.0 | 1010 1100.0001 0010.0000 0010.0000 0000 |

172.18.4.0 | 1010 1100.0001 0010.0000 0100.0000 0000 |

172.18.6.0 | 1010 1100.0001 0010.0000 0110.0000 0000 |

172.18.8.0 | 1010 1100.0001 0010.0000 1000.0000 0000 |

Does the trick still work if you borrow 10 bits to have 1024 subnets? Yes, it still work and below are the first 9 subnets. You increase each subnet by 64 (2^{6}=64). If you notice, after x.x.x.192, the increment will move up to the 3rd octet and the 4th octet start from 0 again because 192+64=256.

172.18.0.0

172.18.0.64

172.18.0.128

172.18.0.192

172.18.1.0

172.18.1.64

172.18.1.128

172.18.1.192

172.18.2.0

What are the ranges of host addresses for the first 5 subnets?

Network Address | First Host | Last Host | Broadcast Address |

172.18.0.0 | 172.18.0.1 | 172.18.1.254 | 172.18.1.255 |

172.18.2.0 | 172.18.2.1 | 172.18.3.254 | 172.18.3.255 |

172.18.4.0 | 172.18.4.1 | 172.18.5.254 | 172.18.5.255 |

172.18.6.0 | 172.18.6.1 | 172.18.7.254 | 172.18.7.255 |

172.18.8.0 | 172.18.8.1 | 172.18.9.254 | 172.18.9.255 |

How many hosts are there per subnet? There are 2

^{9 }– 2 = 512 – 2 = 510 hosts.

To have a more efficient use of the IP addresses you have, we will use Variable-Length Subnet Mask (VLSM). Basically, we are going to subnet an already subnetted network. Okay, let’s try it on the 172.18.8.0/23 subnet to further subnet it into VLSM subnet with only 2 hosts in each VLSM subnet. Bits in red are those bits used in the original subnet which give us 172.18.8.0/23. Bits in blue are bits we used for the VLSM subnetting to get 2 hosts per subnet. We can also apply the trick where we add increase each subnet by 4.

VLSM Subnets | Binary form |

172.18.8.0 | 1010 1100.0001 0010.0000 1000.0000 0000 |

172.18.8.4 | 1010 1100.0001 0010.0000 1000.0000 0100 |

172.18.8.8 | 1010 1100.0001 0010.0000 1000.0000 1000 |

172.18.8.12 | 1010 1100.0001 0010.0000 1000.0000 1100 |

172.18.8.16 | 1010 1100.0001 0010.0000 1000.0001 0000 |

So, we can pick one VLSM subnet say 172.18.8.4 to use for the WAN link.

Routing table in a router is used to determine how to route a packet to its destination. As the number of subnets increased, the routing table will start to grow as well. To reduce memory use on routers and routing protocol network traffic, route summarization has been used. Route summarization is also called route aggregation or supernetting. Okay, let’s try to summarize the route for our 5 subnets.

Subnets | Binary form |

172.18.0.0 | 1010 1100.0001 0010.0000 0000.0000 0000 |

172.18.2.0 | 1010 1100.0001 0010.0000 0010.0000 0000 |

172.18.4.0 | 1010 1100.0001 0010.0000 0100.0000 0000 |

172.18.6.0 | 1010 1100.0001 0010.0000 0110.0000 0000 |

172.18.8.0 | 1010 1100.0001 0010.0000 1000.0000 0000 |

To determine the summary route, we determine the number of highest order bits that match in all the addresses. Those are highlighted in yellow above and that give us 20 bits. We will have a route summary of 172.18.0.0/20; mask of 255.255.240.0. However, the route summary also includes the 172.18.10.0, 172.18.12.0 and 172.18.14.0 subnets. If we don’t own these subnets and if those subnets appeared somewhere else in your inter-connected network, routing issue might occur. To play safe, we can choose to only summarize the first four subnets into 172.18.0.0/21; mask of 255.255.248. The 5th subnet will be 172.18.8.0/23 as a single entry in the routing table.

Okay, enough of decimal to binary and binary to decimal conversion for the day. It is killing my brain cell…

## No comments:

Post a Comment