[TUHS] conventions around zero padding in ip4

Bakul Shah bakul at iitbombay.org
Sun May 8 02:38:07 AEST 2022


On May 7, 2022, at 9:14 AM, ron minnich <rminnich at gmail.com> wrote:
> 
> I first learned in the 80s that 127.1 meant 127.0.0.1. I always
> assumed zero padding was defined in a standard *somewhere*, but am
> finding out maybe not. I talked to the IP OG, and he tells me that
> padding was not in any standard. [side note: it's weird and wonderful
> to still have so many people "present at the creation" of computing as
> we know it still around, and to find they are so willing to answer
> naive questions!]
> 
> Padding is a standard in ip6, possibly because the addresses are so
> long. :: is your friend.
> 
> IP4 padding came up recently: the ip command interprets 10.2 as
> 10.2.0.0, whereas most things (golang libraries, ping, ...) interpret
> it as 10.0.0.2. The latter interpretation accords with what I learned
> 40y ago.
> 
> But, I find myself wondering: where was the first use of the IP4 zero
> padding convention?

From RFC791:

    Addresses are fixed length of four octets (32 bits).  An address
    begins with a network number, followed by local address (called the
    "rest" field).  There are three formats or classes of internet
    addresses:  in class a, the high order bit is zero, the next 7 bits
    are the network, and the last 24 bits are the local address; in
    class b, the high order two bits are one-zero, the next 14 bits are
    the network and the last 16 bits are the local address; in class c,
    the high order three bits are one-one-zero, the next 21 bits are the
    network and the last 8 bits are the local address.

So n.m format == network-number.local-address. The converse question is
who came up with the a.b.c.d format where each of a,b,c,d is in 0..255?


More information about the TUHS mailing list