Subnetting concept can be explained as an efficient way to prevent wastage of IP Address by dividing a larger IP address into multiple smaller addresses that work as an individual unit known as “SUBNET”, and in host network it is known as “SUBNETTING”. This concept can make networks more efficient by enabling network traffic to travel a shorter distance without passing through unnecessary routers to reach its destination. When a network receives data packets from another network, it will sort and route them by subnet so that they do not take an inefficient route to their destination.
Process of Subnetting
As mentioned initially Subnetting is the process of breaking down the larger IP Address into multiple smaller blocks and assigning to individual networks units within the original network.
To understand this let’s first look into the structure of an IP Address. Every IP address has two parts. The first part indicates which network the address belongs to. The second part specifies the device within that network. However, the length of the “first part” changes depending on the network’s class.
Networks are categorized into different classes, labeled A through E. Class A networks can connect millions of devices. Class B networks and Class C networks are progressively smaller in size.
Subnetting breaks the IP Address into two parts as network address and host address, this value varies as per IP Address Class. For Example, in Class A IP Address first 8Bit is network address and remaining Bits are Host Address, likewise in Class C IP Address first three octets (3x 8Bit) are network address and last octet (1x 8Bits) is host address.
For Example: Let us take an /20 IP Block, this can be broken down to 2x /21 or 4x /22 and likewise depending on our needs
What is a subnet mask?
A subnet mask is like an IP address, but for only internal usage within a network. Routers use subnet masks to route data packets to the right place.
Let’s explain the application of subnet mask through this example. Suppose an IP packet is addressed to the IP address 192.0.2.15. Network routers forward the packet to a host on the network indicated by “192.0.2.” Once the packet arrives at that network, a router within the network consults its routing table. It does some binary mathematics using its subnet mask of 255.255.255.0, sees the device address “15” and calculates which subnet the packet should go to. It forwards the packet to the router or switch responsible for delivering packets within that subnet, and the packet arrives at IP address 192.0.2.15
How to Calculate Usable Host in a Network
The host formula (2h– 2) tells us how many hosts can be assigned to the network.
For Example: Let’s assume an organization requires 100 hosts and planning to have 200 Hosts, for this /24 IP Address will be apt for their requirements as it contains 254 usable IP’s.
● CONVERT SUBNET INTO BINARY
Converting the subnet to binary is required to calculate the number of hosts that can be used in a subnet.
/24 – 255.255.255.0 is the subnet mask when converting to binary this would give you
111111111 11111111 11111111 00000000.
● HOW BINARY IS CALCULATED
As we know the IPv4 Address is made up of 32 Bit which is divided into 4 Byte with 8 Bits in each Byte.
For subnet 255.255.255.0 which is converted into binary value using the octet value.
OCTET VALUE IN EACH BYTE
128 64 32 16 8 4 2 1
1 1 1 1 1 1 1 1 ——– if the octet values are added then this will be 255 and likewise for all byte in subnet, then the binary value will be
111111111 11111111 11111111 00000000.
To find out the number of hosts that can be assigned from the subnet we use formula 2h– 2. Where the value of h is the number of 0 present in binary value. from the above binary value, we can see that there are 8 zero available
28-2 = 256 – 2 which is 254, so the total number of usable hosts is 254 and minus 2 IP is reserved for Network identity and Broadcast.
● How to Calculate Number of Subnets
As we saw about the host formula earlier it is also necessary to know about subnet formula (2s). The value of s is the total number of 1 present in the host address.
For Example: Let us take /23 which has binary value 11111111 11111111 11111110 00000000 since the 1st two Byte are for network address, we take 3rd and 4th byte to calculate the number of subnets.
11111111 11111111 11111110 00000000
2s = 27 = 128 is the total number of subnets that can be created to the network.