Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|improve this question

marked as duplicate by grawity, JdeBP, Tog, Heptite, Kevin Panko Feb 19 at 4:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

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.

share|improve this answer
1  
All right, so typing 0.0.3.255 is just another way of typing 3 * 256 + 255, and the fact that we type IP-addresses the way we do is just "canonical", it could be written any way we want really? –  bigbadonk420 Feb 17 at 14:42
1  
Exactly! It's a really smart way of helping us remember the number. It organizes it into small chunks that are easy to remember and it sets up easy to remember bounds like 192.168.x.x –  Zalastax Feb 17 at 14:46
    
Though the dot notation does increase the number of characters by a staggering ~150%. Imagine all the wasted bandwidth and storage space :) –  Roger Dahl Feb 17 at 18:37
1  
@RogerDahl, when they are used on the wire they are in the 32 bit integer form. Many applications store them in the 32 bit integer form. –  Zoredache Feb 17 at 19:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.