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


3 Answers 3


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, is the network address, and 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 ( address only gives you one possible address. This is often used for loopback addresses, and the address must be routed.
  • Using a /31 ( 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 and (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 ( 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.


First ip address of any subnet (for example is network address. It is reserved for that purpose.

The last one is reserved for broadcast address. (

The second address ( , well, it is best for default gateway. Why? You have to set default gateway on each device maybe; which one are you gonna remember the best? or 1.149 for example? So the first and the last are reserved. The first is gateway...

  • 1
    The first address is the network address ( Any valid host address can be used as a gateway address, since a gateway is just a host. It may be a good practice for the gateway to always use the first host address (second network address,, but that address is not reserved for anything.
    – Ron Maupin
    May 16, 2016 at 22:02
  • I was counting like this: First address ---> .0 Second ----> .1
    – LD2
    May 16, 2016 at 22:14
  • 2
    Some places will use the last available IP address as the default gateway, so in this example, Or they may use something else entirely, say they are using something like HSRP and their first router is 192.168.1..1, their second is 192.168.1..2 and the HSRP/default gateway address is 192.168.1..3. As long as an organization uses what makes sense to them and is consistent it really doesn't matter which address is used as the default gateway.
    – YLearn
    May 16, 2016 at 22:22
  • Yes, but my point is that these are all something the admin agrees upon. It's just the way it is.
    – LD2
    May 16, 2016 at 22:51
  • What I was getting at is that the mention of the gateway address in an answer to this question is a non sequitur. It really serves more to confuse the issue.
    – Ron Maupin
    May 16, 2016 at 22:53

Simple formula....find your number of hosts then subtract 2...first address in the subnet=network ID, last IP is the broadcast address used for communication out of the network to other networks.

These two IPs are not valid for assignment to devices on the subnet.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.