What is the network address (x.x.x.0) used for? [duplicate]

It appears to be common practice to not use the first address in a subnet, that is the IP 192.168.0.0/24, or a more exotic example would be 172.20.20.64/29.

The ipcalc tool I frequently use follows the same practice:

$ ipcalc -n -b 172.20.20.64/29
Address:   172.20.20.64         
Netmask:   255.255.255.248 = 29 
Wildcard:  0.0.0.7              
=>
Network:   172.20.20.64/29      
HostMin:   172.20.20.65         
HostMax:   172.20.20.70         
Broadcast: 172.20.20.71         
Hosts/Net: 6                     Class B, Private Internet

But why is that HostMin is not simply 64 in this case? The 64 address is a valid address, right? And whatever the answer, does the same apply to IPv6?

Perhaps slightly related: it also appears possible to use a TCP port 0 and an UDP port 0. Are these valid or used anywhere?


As Wesley, Chopper3, and Willy pointed out modern convention uses the first address (all zeroes host number) for the subnet and the last address (all ones host number) as the broadcast address.

For historical reasons many OSes treat the first address as a broadcast. For example, pinging x.x.x.0 from OS X, Linux, and Solaris on my local (/24) network gets responses. Windows doesn't let you ping the first address by default but you might be able to enable it using the SetIPUseZeroBroadcast WMI method. I wonder if you could get away with using .0 as a host address on an all-Windows network.


I know this is an old thread but I was researching this myself and I didn't stop at "host zero isn't used because it is the network number" because I couldn't see why that mattered. Even if it is the network number it shouldn't stop it being used as a valid address as the mechanism to determine network number (ANDing the netmask) will still work with it to determine the network number.

Not using the all ones host address because it coincides with the broadcast address I was comfortable with, as it is a valid destination address already so when used it would be impossible to distinguish between those.

The more fully explained reason we can't use host zero is that it is also a broadcast address - although RFC1812 section 4.2.3.1 states that a router receiving packets addressed to it "SHOULD silently discard" them (their emphasis - not mine). However the same paragraph does allow those packets to be treated as a broadcast.

Here is the full sub-section

   (2) SHOULD silently discard on receipt (i.e., do not even deliver to
    applications in the router) any packet addressed to 0.0.0.0 or {
    <Network-prefix>, 0 }.  If these packets are not silently
    discarded, they MUST be treated as IP broadcasts (see Section
    [5.3.5]).  There MAY be a configuration option to allow receipt
    of these packets.  This option SHOULD default to discarding
    them.

Because the first address in a subnet refers to the subnet itself and is used for routing purposes.


Early in the internet days, x.x.x.0 was used as the broadcast address for a network. That was later changed to x.x.x.255. I remember that there were options on SunOS to configure the broadcast either as .0 or .255 during that period. So I guess for safety, .0 and .255 have been always a reserved numbers.


The first number in a subnet is the network's address itself. so 192.168.0.0/24 is the number that is used to refer to that subnet. Of course, the last address is the broadcast address where broadcasts are sent to and then pushed down to all clients on that subnet. In IP networking, you always remove 2 from the broadcast address to find the total amount of addressable IP addresses. 192.168.0.0/24 has a broadcast of 192.168.0.255 and thus 253 addressable addresses. 192.168.0.0/26 has a broadcast of 192.168.0.64 and thus 62 addressable addresses.

(Chop and Willy beat me to it -- but I'm grumpy and don't feel like deleting my post. =) )