In TCP, each network must have a unique network number, and every machine on the network must have a unique IP address. IP addresses are classified into two parts: the network part and the host part. The network part specifies the unique number assigned to your network, while the host part is a part of the IP address that you assign to each host, identifying it uniquely on your network.
However, for each host on your network, the network part of the address will be the same, while the host part must be different. So, how do hosts know which portion of the 32-bit is network and which is host? This is where the subnet mask comes in.
When an IP host is configured, a subnet mask is assigned along with an IP address. The subnet mask signifies which part of the IP address is network and which part is host. The subnet mask is compared to the IP address from left to right, bit by bit. The ones in the subnet mask represent the network portion, while the zeros represent the host portion.
To illustrate, let’s take an example of an IP address: 192.168.123.132, with a subnet mask of /24 or 255.255.255.0. The subnet mask, converted to binary, will be 24 ones and eight zeros.
Lining up the IP address and the subnet mask together, the network and host portion of the address can be separated. The first 24 bits, the number of ones in the net mask, are identified as the network address, while the last eight bits, the number of remaining zeros in the subnet mask, are identified as the host address.
In this example, the network address in decimal format will be 192.168.123.0, while the host address in decimal format will be 132. Therefore, the subnet mask /24 (255.255.255.0) and the network ID is 192.168.123.0, while the host address is 132.
In conclusion, understanding IPv4 address, network, host, and subnet mask is vital in TCP/IP networking. It enables you to manage and troubleshoot network issues efficiently. In the next session, we will discuss IPv4 address classes.
Thank you for reading!