Subnet Mask in TCP/IP

What is a subnet mask?A subnet mask is a “translation” of an IP address; it is a 32-bit binary number used for subnet management, primarily to extend the “network ID” in an IP address within multi-segment environments. The two main functions of a subnet mask are: to divide a network into multiple subnets and to distinguish between the network number and the host number in an IP address.Subnet Mask – ClassificationTo quickly determine which part of an IP address represents the network number and which part represents the host number, and to assess whether two IP addresses belong to the same network, the concept of a subnet mask was developed, which is provided in the format of an IP address.

The default subnet masks for Class A, B, and C IP addresses are as follows:

Class A Address:         255 . 0 . 0 . 0
Class B Address:         255 . 255 . 0 . 0
Class C Address:         255 . 255 . 255 . 0

Subnet Mask – AllocationThe specific configuration method is: set the subnet mask corresponding to the network bits of the IP address to “1” and the subnet mask corresponding to the host bits to “0”.For example: For a host with the IP address 131.107.16.200, since it is a Class B address, the first two octets are the network number, and the last two octets are the host number. Therefore, the subnet mask configuration is: 11111111.11111111.00000000.00000000, which converts to the decimal number: 255.255.0.0.Thus, the default subnet masks for various classes of addresses are:Class A: 11111111.00000000.00000000.00000000 or 255.0.0.0Class B: 11111111.11111111.00000000.00000000 or 255.255.0.0Class C: 11111111.11111111.11111111.00000000 or 255.255.255.0

The reason for configuring a subnet mask is that in the Internet, each host’s IP address consists of a network address and a host address. To enable computers to automatically separate the corresponding network address from the IP address, a network mask, also known as a subnet mask, must be specifically defined. This allows for quick determination of which part of the IP address represents the network number and which part represents the host number, and to assess whether two IP addresses belong to the same network.

Leave a Comment