A Network ID can’t be used as a Host IP

Any IP address that identifies a subnetwork (such as 192.168.1.0) cannot be used as a host IP address. For years, I assumed it was some network convention that everybody agreed on. It’s more than that. It’s a physical impossibility.

For example, if you use networks that have only two host addresses, such as network IDs of 192.168.1.0, 192.168.1.4, 192.168.1.6, each of those address cannot be used by a host, and 25% of the addresses are “lost” from the assignable host IP pool. There is a technical reason that cannot be avoided.

To understand why, you have to consider how routers route IP traffic. Consider a router that receives a packet from IP-src destined for IP-dest. The router must determine if the packet needs to be routed off-net through the gateway. The process to do this 3 steps: XOR the src and dest, AND with the network mask, and send to the gateway if the result is non-zero.

Consider a tiny network 192.168.1.0 with netmask 255.255.255.252 (last two bits are zero), which can contain two hosts (192.168.1.1 and 192.168.1.2), along with broadcast address 192.168.1.3. Pretend 192.168.1.1 wants to send to 192.168.1.2:

192.168.1.1
192.168.1.2 XOR
0.0.0.3 Result
255.255.255.252 AND with mask
0.0.0.0. Result “route if non-zero”
Since the result is zero, no need to route the packet, just send it on the local network

Now pretend 192.168.1.1 wants to send to 192.168.1.16 (or any other IP outside of the tiny network we’ve designed):
192.168.1.1
192.168.1.16 XOR
0.0.0.17 Result
255.255.255.252 AND with mask
0.0.0.16 Result “route if non-zero”
Since the result is non-zero, send the packet to the gateway.

All is okay and works fine. Now consider *IF* 192.168.1.4 were allowed as a host address instead of just naming it as a “Subnet ID”:

192.168.1.1
192.168.1.4 XOR
0.0.0.5 Result
255.255.255.252 AND with mask
0.0.0.0 Result “route if non-zero”

It’s zero so no routing would be done, but note that the destination is impossible to represent with the 2 bottom bits that the subset owns. The packet cannot go direct. The packet will not be routed. The result is the packet would die.

You can’t use a network ID address as a host address.

Next interesting question for tomorrow – do Network ID addresses and their associated netmasks have to exhibit consecutive zeros on the least significant bits?

About Brian

Engineer. Aviator. Educator. Scientist.
This entry was posted in General. Bookmark the permalink.

Leave a Reply