How common is fancy IP math accepted by tools?

If we specify an IPv4 address we all usually do the pattern of 1.2.3.4 Now essentially this is only 'a' way of writing a 32 bit number in a more human readable form.

The IP address 1.2.3.4 can also be written as 1.2.(3*256+4) = 1.2.772

This makes that you can have an IP address with 3 dots (i.e. common practise), 2 dots, 1 dot and no dots at all (i.e. normal unsigned 32bit integer written as a decimal integer).

Using such an alternative notation you could write some IP addresses even more readable: 10.10.4000 is the same as 10.10.15.160

One of the nitfy side effects is that if this is used in combination with a webserver like apache, you can define 4 different vhosts on a single IP address without the use of a DNS or hosts file. (Try this at home ;)

I know there are a lot of GUI based tools (like the Windows IP config) that simply have 4 fields that all accept only 0-255. Many commandline tools (like ping, curl, ssh, etc.) and just about all webbrowsers (that basically have a free form address bar) can get 'any' form.

Now my question is: How well are these kinds of alternative IPv4 notations accepted/allowed by tools we have 'in the wild' that accept any form?


It works because of the way the inet_addr function works. Practically every network application's code uses this to convert IP strings to their integer form, and it supports a, a.b, a.b.c, and a.b.c.d notation.

So yes, it should be pretty safe to assume that it's possible to use all four of these notations for an IP address.


I do not like the idea of writing IP addresses in integer representations other than the a.b.c.d form where each of the 4 values is in range 0-255 (with other constraints).

Other notations would simply lead to mis-interpretations and more bugs in the wild.
I vote for identifying all tools and applications that allow such interpretations and fixing them.

We will eventually have the IPv6 notations to work with too; lets not mess things up.


Chrome's location bar will auto complete dotted IPs pretty well, and show you the result while you're typing. I.e., http://10.1 -> http://10.0.0.1, http://10.2.4 -> http://10.2.0.4, etc.


If you stumble upon .NET program that reads IP address, you can count on it supporting decimal representation also. Most of parsers in programming languages I used behave the same.

Unfortunately, quite few of them use RegEx to check whether dotted syntax is entered when you try to do that from UI. So while they are able to parse it, they opt not to.

However, do note that dotted syntax is much more readable and rememberable that decimal representation.