Subnetting and Subnet Mask Explained with Examples.
The subnetting in the computer network divides a bigger network IP address space into smaller independent address spaces. Using subnetting, the same group of connected computers can work as two or more networks independent networks. Each group has a separate network id. A subnet mask is a value for getting a network id from the Ip address.
Subnetting creates two or more separate broadcast networks, which reduces network load and provides more security to the network users.
For example, if a LAN connects to the internet using a router. The computers on LAN are of C class of IP addresses. The LAN can have a maximum of 254 hosts with the same Network Id if a LAN computer has an IP address 192.168.1.*.
The network id is 192.168.1. The subnet mask is 24 bits, and the value is 192.168.1, or we can say 192.168.1.1/24. The total number of network ids possible is 0xFFFFFF in the case of the C class IP address. Which is a considerable amount. Subnetting gives an opportunity of dividing the broad range into smaller ones.
In our example, the subnet mask is 192.168.1.1/24. This means, that when the router needs to send an IP packet to any computer on the LAN, the value of the network address in the destination IP is compared against the 192.168.1 if it matches the packet is sent to the LAN else not.
With the subnetting, we can create two (or more) LANs with the different network masks. One LAN may have a subnet mask 192.168.1.1*/24, and the other LAN have 192.168.2.*/24
Based on subnetting, we can divide the communication computers into groups. The division brings many advantages for the network and LAN users.
Logical separation: In the company, there can be multiple (one HR other is operations) departments. Each has its servers and other things on the LAN machines. If there is no subnetting, each one can access any computer over LAN. With subnetting, only the computers in a subnet address can be accessed. Separation brings more security to the department-specific data.
Reduces Broadcast packets: After subnetting a packet is sent to the computers and those network id matches with the subnet. For example, if there are six computers over LAN with to subnet. Each subnet has three computers with a subnet mask of 192.168.1.1/24 and 192.168.2.1/24, respectively, when an incoming packet comes into the LAN, the router broadcasts the packet to only three machines. Because the network packet can only belong to a subnet, but before subnetting, all six devices get the broadcast.
What is the subnet mask – explained?
Till now, we have explained what subnetting is. In simple terms, subnetting means dividing an IP address into the host and network ID. But how a computer knows what bits are for network ID and what are for Host Id? The answer is the subnet mask. A subnet mask is of the same length as the IP address. E.g., for IPV4, the subnet mask length is 32 bits.
How to get the network Id and Host Id from Subnet Mask?
A subnet mask is applied to an IP address. The output is the network id. Subnet apply means the IP address bits are done bitwise end with the subnet mask.
Default subnet mask for IP address classes:
Following is the default subnet mask for all types of IP address classes.
|IP address class||Subnet Mask (byte1.byte2.bye3.byte4)|