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

Any IP address that identifies a Subnetwork ID (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, imagine networks that uses only two bits, giving 4 distinct addresses. This would be identified with a “subnet ID” of maybe 192.168.1.252 if you kept all the network fixed bits packed to the left and all the computer or device bits zero.  Some of the 4 address cannot be used by a device, and 25% of the addresses are “lost” from the assignable IP pool by no5t using the “all zero” address. If you count the “all host bits 1 broadcast address”, you’ve now lost 50% of the address space with a 2-bit subnet.  Wikipedia says, “In common usage, the first address in a subnet, all binary zero in the host identifier, is reserved for referring to the network itself.”  But it’s more than common usage — there is a technical reason the address cannot be used for a network device.

To understand why, you have to consider how routers route IP traffic. Consider a router that receives a packet 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 router interface address 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.4 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 router interface 192.168.1.1 wants to send to 192.168.1.2:

192.168.1.1 XOR 192.168.1.2 => 0.0.0.3
0.0.0.3 AND 255.255.255.252 => 0.0.0.0

Since the result is zero, no need to route the packet, just send it on the local destination.

Now pretend the router has the interface at 192.168.1.1 and wants to send to 192.168.1.16 (or any other IP outside of the tiny network we’ve designed):

192.168.1.1 XOR 192.168.1.16 => 0.0.0.17
0.0.0.17 AND 255.255.255.252 => 0.0.0.16

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 XOR 192.168.1.4 => 0.0.0.5
0.0.0.5 AND 255.255.255.252 => 0.0.0.0

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.

 

About Brian

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

Leave a Reply