Search code examples
ip-addressipv4

What is the purpose of dot-decimal notation?


If all IPv4 addresses were always written as 12 digits long with no dots, that makes any ip address unambiguous and therefore still work.

For example 127.0.0.1 could be written as 127000000001

I feel this would make parsing and working with ip address easier. If this is the case, then what was the purpose behind the dot-decimal notation? What is the benefit of using dot-decimal notation?


Solution

  • Research has shown humans can only read up to five digits without starting making errors in position of these digits. That's why humans start grouping numbers in thousands. For instance reading:

     1578124
    

    is hard to parse fast. If we however represent it as:

    1 578 124
    

    It is way easier.

    Especially if there are many digits with the same value like:

    1000001101111000100001
    

    one easily looses count.

    The reason why they probably didn't want to use spaces is because most terminals interpret a space as new argument. So:

    ping 127 0 0 1
    connect: Invalid argument
    

    Would be interpreted as four different arguments (hosts). Using dots makes it easy both for humans and machines.

    But an IPv4 address consists out of four bytes (four numbers ranging from 0 to 255). That's done so it can compactly get stored in four bytes in a network package. Nowadays that's of less importance because the bandwidth is that huge that four bytes take no time at all. But in the early days compression of addresses could save much time.

    The same occurs for IPv6 addresses as well. Long sequences of zeros can be abbreviated with ::.