Role of Subnet Mask


Subnetting

Subnetting is the technique of dividing a huge network into many smaller parts, these logical divisions in an IP network reduce the network traffic and also achieve better performance of the network path. This is used in large organizations when many host devices are connected to a single network where the routing process is carried out during traffic and also increases security. Each device connected to the subnet communicates with one another by using routers.

An IP address is used to classify devices on the network which has two parts, the first part represents a network of the address and the second represents the (host part)device connected within the network. Thousands of devices or hosts can be connected to the same network and the respective IP addresses may create complex routes during high network traffic, this is where subnetting comes in, it limits the usage of IP addresses to a few hosts. So, data can reach the destination without visiting other routes. When IP addresses use subnetting the target address can be attained by identifying the network, subnet, and host.

Functions of Subnet mask

The subnet mask consists of a 32-bit address that separates the network and host address. This identifies which portion of the IP address fits into the network part and which fits into the host part. The values of the subnet mask determine how many hosts can be present on the subnet. This contains 1’s and 0’s bits with network bits initialized to 1 and host bits initialized to 0. It is used internally by the routers or switches to send the packets to the target node within the connected local network path.

Two types of subnet masks are available

  • Default subnet mask which is provided by the network classes of A, B, and C

  • The custom subnet mask is designed by the network administrators to combine more devices into a single network. Network.

Role of subnet mask

IP addressing uses five ranges of network classes where Class A can handle up to 16 million hosts, Class B holds up to 65,534 hosts and Class C supports 254 hosts. The other two classes D and E are reserved for multitasking and research sectors.

Default subnet masks are provided by network classes of Class A, B, and C.

Class A range: 255.0.0.0 ,Class B range: 255.255.0.0 and Class C range : 255.255.255.0

  • Class A subnet defines the initial eight bits for the network part and the rest of the 24 bits represent the IP address’s host part. Consider an example IP address:10.26.82.43 As per the default mask range of Class A, the given IP address can be divided into network and host portions.

  • 10.0.0.0 represents the network address and 26.82.43 defines the host address.

  • Class B subnets have a network address with 16 bits and the rest of 16 bits for the host address. Consider the IP address:128.22.45.17 Here network portion will be 128.22.0.0 and the host address is 45.17

  • Class C subnet mask has initial 24 bits for the network node and the rest 8 bits for the host portion within the network. Consider the host IP address:192.168.8.2 then 192.168.8.0 defines the network portion and the host address is 2.

Consider an example of a packet that has a destination address of 200.1.4.18 here router has to identify the subnet where this given destination IP belongs, it is done using the subnet mask.

To identify which network the destination address belongs to, a bitwise AND operation has to be done for the binary values as below −

The binary representation  of 255.255.18.22   =11111111.11111111.00010010.00010110 
The binary representation of 200.1.4.18       =11001000.00000001.00000100.00010010    
Bitwise AND(&)                                =11001000.00000001.00000000.00010010

This can be given in decimal form as 200.1.0.18. After this process, the router will forward the data packet through an interface internally. Routing tables are constructed by the router after transmission, value in the table gets updated. The matching interface will be identified with the help of a routing table. If there is no match on the network address with the routing table the data packets are forwarded to the default entry 0.0.0.0

The Source node decides whether the destination node is at the local network or remote when it wants to make communication with the target node. The initial node uses a subnet mask to get details of local and remote networks. AND operation is performed between the subnet mask and source IP this AND operation is repeated for the destination IP address also.

After AND operation, if the result is the same on the source and destination node then it implies both lie on the same network, if values are different then either of the nodes is located on a remote network.

Conclusion

Subnetting reduces collision and network traffic thereby providing better performance. This provides full control to the IT administrators on monitoring data packets, enabling or upgrading router devices, reduce traffic over the network. The Subnet mask addresses are needed to identify between the host and network address so the routers match the data packets to the target node and find the best route for data transmission between the sender and receiver interface.

Updated on: 05-May-2023

393 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements