In this article, we will be discussing IPv4 addresses, network and host portions, and subnet mask. Every machine running TCP on a network must have a unique IP address, and each network must have a unique network number. The bytes of 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. It uniquely identifies the machine on your network.
The subnet mask plays a crucial role in determining which portion of the 32-bit IP address is the network and which portion is the host. In TCP, the parts of the IP address that are used as the network and host addresses are not fixed. Therefore, the network and host addresses cannot be determined unless you have more information. This information is supplied in another 32-bit number called a subnet mask.
When an IP host is configured, a subnet mask is assigned along with an IP address. Similar to an IPv4 address, the subnet mask is represented in dotted decimal format for ease of use. 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 determine the network address and the host address of the IP 192.168.123.132, let’s take an example. In this example, the subnet mask is /24 or 255.255.255.0. If you convert the subnet mask into binary, it 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. This gives you the following network address in binary format: 11000000.10101000.01111011.00000000. The network address in decimal format will be 192.168.123.0, and the host address in binary format will be 00000000. If we convert this to decimal, we will have a host address of 132.
In summary, from this example, we can determine that a /24 subnet mask has a network ID of 192.168.123.0 and a host address of 132.
In our next session, we will discuss IP address classes. Thank you for reading.