IP – Why Are Number of Hosts on a Subnet Less Than Possible Combinations?

ipip addressipv4subnet

Suppose we have a Class C Subnet (255.255.255.0), why do we get to have 254 hosts on it even though we have 256 unique internal IPv4 addresses from 192.168.1.0 to 192.168.1.255? Even if we scale up the number of subnets using the mask 255.255.255.254, why can't we have any devices on the subnet even though there is 192.168.1.0 and 192.168.1.1 available?

Best Answer

First, classful routing is dead, and it has been for over 20 years, killed by VLSM and CIDR (see RFCs 1518 and 1519).

For IPv4 you cannot use the network or broadcast addresses as host address assignments. In your example, 192.168.1.0 is the network address, and 192.168.1.255 is the broadcast address. Those addresses have special meaning to IPv4, and assigning them to hosts causes problems.

There are a couple of exceptions to this:

  • Using a /32 (255.255.255.255) address only gives you one possible address. This is often used for loopback addresses, and the address must be routed.
  • Using a /31 (255.255.255.254) network has only two possible addresses, both of which can be used for host addresses. used for a point-to-point link. Meaning you can use both 192.168.1.0 and 192.168.1.1 (the only two available addresses) as host addresses. This is per RFC 3021 Using 31-Bit Prefixes on IPv4 Point-to-Point Links.

So, Your example of increasing the number of networks using /31 (255.255.255.254) networks will work for point-to-point links.

This only applies to IPv4, since IPv6 can use all the addresses in a subnet, even the first and last addresses.

Related Topic