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?
Answer
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.
No comments:
Post a Comment