3 ms·
> Here’s another neat trick. You can overflow a digit. \n\n [...] PING 10.0.513 (10.0.2.1) That's not exactly what's happening. You're omitting the fourth octe
by lucb1e 4y ago
> Here’s another neat trick. You can overflow a digit. \n\n [...] PING 10.0.513 (10.0.2.1)
That's not exactly what's happening. You're omitting the fourth octet so this is then interpreted as a decimal part of the address (you can also have it be interpreted as hex or octal with the usual prefixes).
10.0.0.513 won't work because overflow isn't really what's happening. (For a minute you had me wondering if I missed something in my IP address variants tool because I didn't know that 9.256.0.1 would work as 10.0.0.1, but no, it can't and I've got the other case covered. Whew!)
The example can be written more succinctly as 10.513
- electroly 4y agoWhat's happening is more obvious when you consider that you can equivalently write it as simply 167772673. Try `ping 167772673`!
- lucb1e 4y agoNo need to ping if all you want is the conversion :) Just type it into the address bar: https://snipboard.io/kbLTso.jpg https://snipboard.io/kbLTso.jpg (previously posted that screenshot in 2021 https://news.ycombinator.com/item?id=29050936 https://news.ycombinator.com/item?id=29050936)
- sigjuice 4y agoThe address bar is also a bit excessive for doing conversions. $ getent hosts 127.1 127.0.0.1 127.1
- rnk 4y agoHow about 134744072, that hits my favorite am-I-connected site. I never knew you could put an int representing the 4 bytes together until today, this is really fun. Even hex works, but doesn't hit a site that responds: (ping 0xcafebeef).
- peoplearepeople 4y agoI enjoy using "ping 0x1010101"
- moefh 4y agoInteresting, so that's also whats happening with 127.1 and 127.0.1: the zeroes are not being "inserted automatically", they come from expanding the last number (1) into the bits for the last bytes of the address. To make it clearer: - for "x", then "x" is all 4 bytes of the address - for "x.y", then "x" is the first byte of the address and "y" the last 3 bytes - for "x.y.z", then "x" is the first byte, "y" is the second" and "z" is the last 2 - for "x.y.z.w", then each of the numbers is its own byte
- eftychis 4y agoThat is correct. The dots are there for our convenience to be able to spot individual bytes. I hope the author addresses and edits their article accordingly.
- mynameisvlad 4y agoTheir article from 3 years ago? I somehow doubt they're going to be making any edits now.
- kamray23 4y agoI guess the most useful way of describing the dot-decimal notation for IP(v4) addresses is that it consists of at least one and at most four numbers separated by dots, each of which represents on octet of the address (MSB on the left), save for the last number, which always represents all remaining octets. Each number is by default a decimal number but can also be an octal (prefix 0) or a hexadecimal number (prefix 0x). That should include all cases. Stuff like 10.05003 → 10.0.10.3.
- ta1243 4y ago> The example can be written more succinctly as 10.513 The most useful example I use on a day to day basis is dig foo.com @1.1 or ping 1.1 Which expands to 1.0.0.1
- qiqitori 4y ago0 for 0.0.0.0 is useful too. I often do things like ping 0 or ssh 0 (perhaps with a different port number) to ssh into localhost. 0 expands to "0.0.0.0" and can be used in place of localhost in many situations. (https://serverfault.com/questions/876698/whats-the-difference-in-localhost-vs-0-0-0-0 https://serverfault.com/questions/876698/whats-the-differenc...)
- chrismorgan 4y agoAnd this is why the second address for the 1.1.1.1 DNS service is 1.0.0.1. `mtr 1.1` (with MTR_OPTIONS="--displaymode=2" in my environment, super useful display mode for general connectivity diagnostics) is my standard “my internet connection doesn’t seem to be working perfectly, where’s the problem?” tool.