6 ms·
Why does pinging 192.168.072 return a response from 192.168.0.58?
- jnazario 14y agoin this case it's octal in action. leading 0 causes the libc calls to expect non-decimal input (octal or hex, depending on what comes next). a few organizations, FWIW, insist on writing decimal dotted quads zero padded (e.g. 192.168.19.20 becomes 192.168.019.020) for evan formatting. this barfs various tools and scripts that (not surprisingly) expect octal if they see a leading 0 and then barf on the non-octal-ness of the data OR get it wrong. something to be aware of, especially if you script batch processing of inputs that include lists of IPs.
- geophile 14y ago072 octal = 58 decimal? Seems to work. My localhost is 172.16.53.144 and pinging 172.020.53.144 works, returning 172.16.53.144. Never knew that notation was supported.
- rhizome 14y agoThis is just a me-too submission from the "1111-0111" thread going around. http://www.reddit.com/r/javascript/comments/11d9ya/can_someone_please_explain_this_behaviour_1111/ http://www.reddit.com/r/javascript/comments/11d9ya/can_someo...
- deleted 14y ago[deleted]
- aw3c2 14y agoThat makes me want to own 222.173.190.239 or 177.107.0.181, just to link to them in hex. If only browsers would keep that in the address bar.
- jevinskie 14y agoJust think of the fun you can have with the bottom 64 bits of an IPv6 address!
- simcop2387 14y agoPersonally I'd love to get a hold of http://202.254.186.190/ http://202.254.186.190/ for linking.
- veidelis 14y ago0xCAFEBABE
- tspike 14y agoFor those too lazy to convert, that's 0xDEADBEEF and 0xB16B00B5, respectively. EDIT: Fun fact: Chrome's address bar will convert hex IPs for you on the fly. Try typing in http://0xDEADBEEF http://0xDEADBEEF and look in the suggest box.
- scoot 14y agoApparently 0xB16B00B5 made into some Microsoft HyperV code: http://www.bbc.co.uk/news/technology-18922629 http://www.bbc.co.uk/news/technology-18922629 Blame? http://www.spinics.net/lists/linux-driver-devel/msg15311.html http://www.spinics.net/lists/linux-driver-devel/msg15311.htm...
- rplnt 14y agoI tried the first one and since I have Google's Feeling Lucky as the default search engine I ended up here http://en.wikipedia.org/wiki/Hexspeak http://en.wikipedia.org/wiki/Hexspeak :)
- gioele 14y agoHave a look at this other answer by LarsH: <http://superuser.com/a/486904/99285> http://superuser.com/a/486904/99285>. I think it is a much better more in-depth answer than the accepted one.
- danielweber 14y agoMore tools besides ping used to support this. I distinctly remember that a RedHat upgrade broke acceptance of "1.2" in tools like ssh as an IP address and demanded 4-octet addresses sometime around 2003.
- tzs 14y agoNote that when you write an IP address in the form a.b.c, the c is actually allowed to be 16 bits. E.g., 192.168.2345, which is equivalent to 192.168.9.41. Note also that telephone numbers in the US can be written in the form a.b.c, where a and b are 3 digits and c is four digits. It would be really cool to get a matching telephone number and IP address, so you could print on your business card something like "Telephone and IP: 206.253.2317".
- MichaelGG 14y agoWell the IP is global, but the number you provided is ambiguous. Egypt's country code is 20, following 62 is Suez[1]. Search for "+20 62" and you'll see 10 digit numbers that would ring in Egypt instead of Seattle. As a side note/tip: Most phones these days (well, Android, iPhone, and Skype) accept the + for fully formatted numbers[2]. It makes it handy if you travel and want your stored contacts to work regardless of phone network. 1: http://en.wikipedia.org/wiki/Telephone_numbers_in_Egypt http://en.wikipedia.org/wiki/Telephone_numbers_in_Egypt 2: http://en.wikipedia.org/wiki/E.164 http://en.wikipedia.org/wiki/E.164
- khuey 14y agoIt's only ambiguous if you ignore how the numbers are separated. It's also probably obvious from context whether or not it's a US telephone number.
- riffraff 14y agoIsn't "+xxx" been used in GSM phones for the last decade?
- adestefan 14y agoIt's been even longer than that. If you look at most mobile phones with real key pads there will be a + on the 0 key. You hold 0 to dial the +.
- deleted 14y ago[deleted]
- smackfu 14y agoSo has anyone ever intentionally used this feature?
- galvanist 14y agoSpammers and malware authors sometimes use this in an attempt to obfuscate URLs.
- wmf 14y agoThis kind of non-obvious behavior seems like a dark side of Postel's Law.
- jrockway 14y ago0x1234 is hexadecimal. 1234 is decimal. 01234 is octal. 0b1011011101111 is binary. It's de-facto standard, especially in the UNIX world.
- gue5t 14y agoThe new wave for octal notation is 0o1234; it's supported by haskell and some others and seems much cleaner to my tastes.
- wmf 14y agoI was thinking more of the two dots instead of three. (Interestingly, RFC 791 does not define dotted-quad notation. It must have been added later.)
- gurkendoktor 14y agoIt's a standard that everyone knows because they have been bitten by it. :( I was curious about it being limited to the UNIX world, and indeed, C# is the only C-like language that does not have this feature. On the UNIX side, even Go decided to keep them [0]. Python dropped them in v3 but I'm not sure if that counts as a UNIXy language or not... [0] http://groups.google.com/group/golang-nuts/browse_thread/thread/c6cdb49ae7ccc8c6 http://groups.google.com/group/golang-nuts/browse_thread/thr...
- deleted 14y ago[deleted]
- piffey 14y agoYou can use this in your web browser. Some really crappy local filters will also let you pass by using decimal/octal notation. Was a great trick in high school.
- Gilly_LDN 14y agoAlso, it is allowed in the ICMP standard, that a device can respond if it is pinged directly and also if its subnet broadcast address is pinged.
- JoachimSchipper 14y agoSee also: smurf attack.
- rachelbythebay 14y agoAll of those posts and no mention of strtol(), which is probably what's making this base-swapping behavior actually work? Oh well. $ ping 0x7f.0x0.0x0.0x1 PING 0x7f.0x0.0x0.0x1 (127.0.0.1): 56 data bytes
- ojiikun 14y agoIt is a sad day for computing when - hackers can't read an RFC - hackers don't know octal - hackers can't trial-and-error an interesting behaviour until they see a pattern and learn for themselves.
- humdumb 14y ago- hackers don't read source code All one has to do is look at the source for ping and questions like these are answered.
- cnvogel 14y agoI'll not look this up now, but I'm pretty sure that the answer is found in inlet_aton() in the c-library ping has been linked against, not ping.
- Retric 14y agoI think you meant inet_aton() or inet_addr(). However, the value of looking at ping is it let's you see a simple example of a lot of networking system calls which you can then dig into. I had a class project to write a simple web-server and text based browser in C and ping was actually a great place to start.
- deleted 14y ago[deleted]
- meaty 14y agoI think its sadder not that they don't know but don't bother our of sheer apathy and expect canned knowledge ready to be pumped into their minds on stack exchange or google. That applies to the majority of 'knowledge' these days.
- mikiem 14y agoI feel old. I have seven this question several times, but only every 3-5 years.
- ashleyw 14y agoI stumbled upon this by accident a couple of years ago. Setup your internal network to start at 10.0.0.1 (or should I say…10.1), and you'll never need to type out a bunch of zeros again! My NAS has a static IP of 10.2. :)
- Axsuul 14y agoI prefer using the hosts file, it's just easier to remember
- ashleyw 14y agoI don't have a large network, so it's not too hard to remember. It's nice to know how to reach my Raspberry Pis from any machine, regardless of what I'm using them for or what hostname they have at the time (XBMC, AirPlay server, etc.)
- 6ren 14y ago$ ping 10.010.0x10 PING 10.010.0x10 (10.8.0.16) 56(84) bytes of data.