Why does writing IP addresses this alternate way work, and is there a practical use case for it? [duplicate]

Posted on

QUESTION :

Recently I saw an incorrectly typed telnet command, and I saw that “regular” numbers were interpreted to IP addresses. I tried this myself in Windows and the same behavior is shown there, so obviously this is an acceptable way of typing IP addresses. I’m just wondering if someone can explain how this works, and if there are any real world applications for it (i.e. when would this way be better/simpler?).

I seem to see a pattern here but I still can’t quite figure out why you would ever type addresses this way:

>ping 255
Pinging 0.0.0.255 with 32 bytes of data:
PING: transmit failed. General failure.

>ping 256
Pinging 0.0.1.0 with 32 bytes of data:
PING: transmit failed. General failure.

>ping 257
Pinging 0.0.1.1 with 32 bytes of data:
PING: transmit failed. General failure.

>ping 16581375
Pinging 0.253.2.255 with 32 bytes of data:

>ping 1658137511
Pinging 98.213.43.167 with 32 bytes of data:
Reply from 98.213.43.167: bytes=32 time=170ms TTL=47

ANSWER :

Since IP adresses are represented as “normal” numbers inside the computer it’s quite normal to be able to represent it as a “normal” number in the input.
http://en.wikipedia.org/wiki/IP_address

In IPv4 an address consists of 32 bits which limits the address space to 4294967296 (232) possible unique addresses. IPv4 reserves some addresses for special purposes such as private networks (~18 million addresses) or multicast addresses (~270 million addresses).

IPv4 addresses are canonically represented in dot-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots, e.g., 172.16.254.1. Each part represents a group of 8 bits (octet) of the address. In some cases of technical writing, IPv4 addresses may be presented in various hexadecimal, octal, or binary representations.

Use cases for this would probably mainly be if you got an unformatted output of an IP adress from some software.

Leave a Reply

Your email address will not be published. Required fields are marked *