IPv4 Router – Why is This a Network if All Host Bits Are Zeros?

ipv4router

let's say that we have a router with address: 172.31.219.33/27 from this I can tell several things:

  1. Subnet mask: 255.255.255.224
  2. Broadcast address (here I am not sure if last digit should 64 or 65 – see later): 172.31.219.64
  3. Last host address (since we know broadcast address; also not sure if last digit should be 63 or 62): 172.31.219.63

We could also tell first host address (172.31.219.33) and network address (172.31.219.32).

I don't understand two things:

  1. Why is first host address X.X.X.33? It is like the router is already host?
  2. Why is network address X.X.X.32? In other way, why it is not X.X.X.33 (from router address)?

Best Answer

Why is first host address X.X.X.33?

  1. It is like the router is already host?
  2. Why is network address X.X.X.32? In other way, why it is not X.X.X.33 (from router address)?

The reason for calculating network addresses and host addresses like this is specified in RFC 950 and RFC 1878; contiguous binary network masks are used to divide IPv4 addresses into host portions and network portions; if the host portion is all-zeros, that is by-definition a network, and not a host.

10101100.00011111.11011011.00100001    => IP 172.31.219.33 as binary
11111111.11111111.11111111.11100000    => 27-bit network mask (binary AND with IP for net)
                              ^^^^^
                                Host bits are zero in a network mask
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             Network bits are ones in a network mask
----------------------------------------------------------------------------
10101100.00011111.11011011.00100000    <= 172.31.219.32 is the *network*

If you need help understanding how to calculate these correctly, we have many Q&As which already respond to this problem.

Related Topic