IPv4 network addresses vs. host addresses
IP network addresses and IP host addresses
Every IP address is split into two parts:
- The network section
- The host section
The network section (network ID)
The first section of an IP address identifies the network the address belongs to. This section is often called the network ID.
A helpful analogy is a phone number:
- The area code tells you which city or region the number belongs to.
- In the same way, the network section tells you which network an IP address belongs to.
The host section
The second section of an IP address identifies a specific device (a host) on that network. This is the part that’s assigned to a device.
Using the phone number analogy again:
- The host section is like the actual phone number assigned to a specific phone.
The subnet mask
A subnet mask is another 32-bit number, written in dotted decimal notation, that is used alongside an IP address. Its job is to show:
- where the network section of the IP address ends, and
- where the host section begins.
In other words, the subnet mask marks the boundary between the network and host portions of an IP address. Once you know that boundary, you can also calculate how many IP addresses a network can hold.
How the subnet mask marks network vs. host bits
A subnet mask is also split into two sections:
- The network section is made of all “on” bits (1s).
- Wherever the subnet mask has a 1, that bit position belongs to the network portion of the IP address.
- The host section is made of all “off” bits (0s).
- Wherever the subnet mask has a 0, that bit position belongs to the host portion of the IP address.
Just like with IP addresses, to convert the binary value of an octet to decimal, you add the positional values wherever there is a “1” in that octet.
In the image above, we end up with a subnet mask of 255.255.255.0 in dotted decimal notation.
Applying a subnet mask to an IP address
When you apply the subnet mask to an IP address, you can see which bits are network bits and which bits are host bits.
For example, take the IP address 192.168.1.2 with a subnet mask of 255.255.255.0:
Here, the network section (the network bits) is 192.168.1.
The host section is the .2 portion. The boundary between network and host is between the third and fourth octet. That means:
- The entire fourth octet can be used for host addresses (assigned to devices such as NIC cards on computers and servers, or router interfaces).
- The network section tells you which network those host addresses belong to.
Network address (network ID)
You can derive the network address (also called the network ID) from the subnet mask.
For this network, the network address is 192.168.1.0. This happens because:
- the network bits stay the same, and
- all host bits are set to 0.
When all the host bits in an IP address are 0, that IP address is the network address.
Host addresses
The moment you have any bit turned “on” (1) in the host section of an IP address, you’re looking at a host address.
Finding the last address in the network
To find how many IP addresses the 192.168.1.0 network can hold, you can turn on all the 1s in the host section.
That gives 192.168.1.255 in dotted decimal. This is the last possible IP address in the network, so the full network range is:
- 192.168.1.0 - 192.168.1.255
So, the usable host range is:
- 192.168.1.1 - 192.168.1.254
Out of the 256 total addresses in the network (192.168.1.0 - 192.168.1.255), only 254 can be assigned to hosts (.1 - .254).
Comparing two similar-looking IP addresses
Compare these two IP addresses, both using a subnet mask of 255.255.255.0:
- 192.168.1.1
- 192.168.2.2
These two IPs can look like they belong to the same network because the first two octets match. But the subnet mask shows that the third octet is part of the network section, and the third octet is different:
- 192.168.1.x is one network
- 192.168.2.x is a different network
Because the network portion produces different values, these are separate networks.
Another example with a different subnet mask
Now compare 172.16.1.4 and 172.16.2.8 using a subnet mask of 255.255.0.0.
Are these two IP Addresses within the same Network?
Yes, because they both have the same value for the Network bits section of the Subnet Mask therefore, they are in the same Network.
As long as the network bits align between IP addresses, those IP addresses are part of the same network.







