What is Subnetting And When & Why It becomes Necessary
Subnetting is breaking down of a larger network into multiple sub networks aka subnetting. So why do we need to break down a larger network into multiple smaller networks? but before you can start to understand what subnetting is and how to subnet. You need to know the basics on how IP addresses, subnet mask and an octet chart works. Give these ( Networking Basics , What is a Subnet Mask? ,Octet chart &Binary to Decimal conversion ) a read before hand to understand those concepts first.
Moving on, The reason for that is quite simple if a large network let’s say a business organization has dozens of computers that need to communicate with each other. Now what would it look like?
Here is a network let’s say with over 50 computers connected together through switches.
- The address range is 192.168.1 to 192.168.1.254
- 192.168.1.0 being the Network ID & Broadcast ID being 192.168.1.255
Now, If computer “A” wants to communicate with computer “B” it will send a broadcast to every computer on the network 192.168.1.0. Based on our example that are over 50 computers that will receive that broadcast. This puts strain of the network and needlessly slows it down and can even bring the network to a halt.
How To Avoid Network Congestion
So to avoid this network congestion we use subnetting along with multiple routers and switches. Since, traffic cannot be broadcast through a router (default gateway) but only within the network itself.
So what we did:
- We have added two switches and a router (which is connected with both switches).
- Each switch allows communication between each computer in it’s own network locally.
- The router acts as a barrier and keeps the broadcasts within the local network and as soon as a Network IP that does not belong to the network is detected. It gets sent over to the router.
Now let’s say computer “A” wants to communicate with computer “X” remotely. It will first compare it’s own with IP address with computer “x”s IP address and since the third Network octet of computer “A” is 1 and compute “X” is 2. This means they are not on the same network. This is when it will send an ARP broadcast to the router (default gateway) getting it’s Mac address and then sending the data (IP packets) over to the router. The router then forwards the data to the destination computer “x”
This prevents computer “A” from broadcasting to every single computer on it’s own network and send it over to the default gateway instead. Keeping the local network free of traffic congestion
How to Subnet
Now that you know the “what” and the “why” to subnetting. Let’s talk about how to subnet. Let’s take class “C” network as an example. the default subnet mask 255.255.255.0 allows for 254 host IP’s and 1 network. Now, considering you already know about the octet chart and binary to decimal conversion.
We know that when we need to divide a network into multiple subnets we borrow from host portion of the subnet mask
As seen above the default subnet mask for class “C” see has (24) 1’s and (8) 0’s. The formula to calculate how many subnets we have and how many host id’s we can have in a particular subnet is
- Compare the new subnet mask with the default subnet mask this will give you the No. of network bits and the No. host bits that are borrowed/stolen
- To find the No. of subnets= 2 raised to power (no. of bits borrowed from host) = 2 ^2 =4 subnets (since two bits were taken)
- For host IP’s = 2 raised to power (No. of host bits left)= 2^6=64 Host IP’s
- So By borrowing two bits from the host we get 4 subnets with 64 hosts per subnet.
Example:
(NOTE: The value that should be zero based on the default subnet mask is the last octet 192. That is what we subtract from 256)
Since the interested octet in the subnet mask is the last octet (192). We start the first Network ID from “0” hence the first subnet Network ID being 192.168.1.0. The 64 also referred to as the “Magic number” comes by subtracting whatever your interested octet in the subnet mask is (192) in this case. This 64 is what we will add to each to the first Network ID until we get 4 subnets.
You cannot go beyond 192.168.1.192 because after adding 64 to 192 we get 192.168.1.256. The maximum we can go is 255. That’s why we stay with the lowest before 256. In this case 192. Hence, further ensuring that we have 4 subnets as found out by using the formula.
(NOTE: An interested octet is the first octet in the subnet mask that’s value is less than 255. Here are a few Examples with class A,B,C :
- 255.255.232.0 (232 is the interested octet)
- 255.192.0.0 (192 is the interested octet)
- 255.255.255.0 (0 is the interested octet or whatever the number in it’s place is )
- 255.172.0.0 (172 is the interested octet)
Host IP’s ranges, Broadcast ID & Network ID
As shown above, The starting IP of any network range is the network and the very next IP in this case 192.128.1 .1 ,65, 193 are all the starting host IP’s. The network’s very first IP is the network itself (0,64,128,192) while the last IP for every single network range is The Broadcast IP. So in short, Every IP from 1.1 – 1.2 – 1.3 … 1.62 are host IP’s that can be given to host devices.
(Note: The network bits of every class of network. “C” in this case does not change. Hence 192.168.1 remained as the constant because that’s the network octets. The last octet is the only one changing as that is the only host octet in a “C” class network.)