[TUHS] conventions around zero padding in ip4

Bakul Shah bakul at iitbombay.org
Sun May 8 09:19:53 AEST 2022


On May 7, 2022, at 12:14 PM, Warner Losh <imp at bsdimp.com> wrote:
> 
> 10.2 is ambiguous. In a network context, it means, typically, 10.2.0.0/16 (though your mileage may vary).
> In a host context, it means 10.0.0.2. It's this confusion that has lead to many efforts
> to outright kill this notation.

On FreeBSD:
ping 10.2 tries to ping 10.0.0.2 and
ping 192.168.300 tries to ping 192.168.1.44 (1*2^8+44 == 300)
ping 10.2.300 tries to ping 10.2.1.44
ping 192.1000000 tries to ping 192.15.66.64 (15*2^15+66*2^8+64 == 1000000)
ping 1000000001 tries to ping 59.154.202.1 (59*2^24+154*2^16+202*2^8+1)
ping 300.300 tries to ping 23.217.138.110 (I haven't worked this out! Prob. a bug)
So the last number is treated as the host number on a given net.
This may have some sense in the classful network world but is
very confusing in the CIDR world.




More information about the TUHS mailing list