There’s more than one way to write an IP address (2019)
ma.ttias.be
ma.ttias.be
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
Just type it into the address bar: https://snipboard.io/kbLTso.jpg (previously posted that screenshot in 2021 https://news.ycombinator.com/item?id=29050936)
$ getent hosts 127.1
127.0.0.1 127.1...but you realize we're conversing via a website, right? :D Most people will already be in a browser!
Even hex works, but doesn't hit a site that responds: (ping 0xcafebeef).
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
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.10 expands to "0.0.0.0" and can be used in place of localhost in many situations. (https://serverfault.com/questions/876698/whats-the-differenc...)
`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.
const a = document.createElement('a');
a.href = 'http://032166163360';
console.log(a.href);
// "http://209.216.230.240/"
a.href = 'http://127.1'
console.log(a.href);
// "http://127.0.0.1/"
a.href = 'http://10.50.1'
console.log(a.href);
// "http://10.50.0.1/"
a.href = 'http://10.0.513'
console.log(a.href);
// "http://10.0.2.1/"
a.href = 'http://0xA000201'
console.log(a.href);
// "http://10.0.2.1/"
a.href = 'http://10.0.2.010'
console.log(a.href);
// "http://10.0.2.8/"
and also: console.log(new URL('http://10.0.513').host)
// "10.0.2.1"u32 undotted
u8.u24 dotted-signal
u8.u8.u16 dotted-triple
u8.u8.u8.u8 dotted-quad
^ where each of the above is allowed to be octal, hex, or decimal
The internet used to be more fun when it was all fun and games and we didn't need to worry about every possible type of user misleading :(
I remember in the 2000s, there was some site using a decimal IP address (as a single number, not dotted quad) that had hacking/crypto puzzles. Something with a "Alice in Wonderland" theme. Does that ring a bell for anyone?
Was it called ninebows? I was looking online for that a while ago to show a friend, and I remember in school reading pages and pages of forum threads about it: speculation of what this or that meant, ideas for solving the next puzzle, et c. It was a website with some hidden puzzle that, once solved, would leave you with another link somewhere else with another puzzle that needed solving.
Someone eventually won, too, but it looks like it just vanished off the face of the Internet like many things from that era. Either that, or my search engine skills aren't good enough.
$ ping ①②⑦.⓪.⓪.① PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
(doesn't work on Windows btw)
Works in Gitbash in Microsoft Terminal, which is cheating a bit, but doesn't introduce a different OS.
Edit: Works in Powershell too.
http://xn--orhcp.xn--mvh.xn--mvh.xn--orh:8000 -> http://127.0.0.1:8000
EDIT: WingDings is the Grandparents to Emojis.
edit: 0x01="smiley face white on black", 0x02="smiley face black on white" were filtered by HN
I wanted to use "great grandparents" but I made the false assumption that the HN audience wouldnt have identified, but holy crap we do.
I think we need a knowledge archive asap.... we are going to start dying off soon.
The next decade is going to decimate some minds.
> PING 10.0.2.010 (10.0.2.8)...
It was all fun and games until they started mixing bases, decimal and octal in the same address.
That's just cursed.
Try also http://0xD1D8E6F0 and http://3520653040
Also there are times I don't have DNS working. Often times at some console where copy/paste also isn't working or where I don't even have a mouse, and I extra appreciate the simpler typing :)
Also to specify a bind address when I don't care, like running `php -S 0:3000` (the silly thing wants a bind address rather than only a port number. There, have one!) or accessing localhost in a browser (just typing 0:3000 is enough). For 127.0.0.1, unfortunately the best you can do is writing 127.1. The numeric, hex, and octal variants are 2130706433, 0x7f000001, and 017700000001, which I personally don't find preferable to 127.1.
In MySQL for example, that's what INET_ATON() and INET_NTOA() are for, to convert between binary and display.
Analogous to storing timestamps but displaying as datetimes in a timezone.
https://www.postgresql.org/docs/current/datatype-net-types.h...
[0] https://www.postgresql.org/docs/current/functions-net.html
https://news.ycombinator.com./item?id=35751030 ;-)
( warning: your cookies for news.ycombinator.com won't work in news.ycombinator.com. )
It checks to see if Cloudflare is responding, which 99.9% of the time is going to tell you if your internet is working :)
There’s more than one way to write an IP address - https://news.ycombinator.com/item?id=20390759 - July 2019 (48 comments)
Lesson learned: always save that topic for last, so the rest of the day isn’t a disaster.
When we came upon CIDR and VLSM, our instructor (very knowledgeable, down-to-earth, pragmatic) introduced us to various calculators that could assist us, although he did also show us a manual way to graph out each bit. Then he admitted that the VLSM portion of the class had often driven his previous students to tears, and he didn't want to see anyone crying over this anymore.
Except ASCII is 7-bit, and a number of those are control characters. So you couldn’t, and many that you could would be unreadable. <DEL><NUL><NUL><SOH> for localhost is... not ideal.
There's no place like <DEL><NUL><NUL><SOH>
edit ^H is also swallowed by the line editor of course.
For the most part, applications tend to punt the job of interpreting such text address representations to the IP stack (usually embedded in the OS kernel). These vary in what they'll accept by implementation and version, but they tend to be extremely good at interpreting whatever arbitrary nonsense people have historically been likely to try. As a result, there are surprisingly few application-level libraries which even attempt to deal with that mess.
The fact that 12 and 012 mean drastically different things in many languages does not ever feel good.
> for complicated parsing
Somewhat
> numerous exploits.
Nah. It's mostly localized to a string to hostname processing, ie it never occurs in the network stack and happens on the user'side of things and permissions (think CLI and interpreted languges)
As an example, think of a cloud based web performance monitoring system. I trick it into making HTTP requests to 169.254.169.254, and I get access to data from their AWS metadata service...
Of course the reply was just a deflection, even though OpenBSD was the only buggy one.