6 ms·
TIL you can also use 1.1 and it will expand to 1.0.0.1 $> ping 1.1 PING 1.1 (1.0.0.1) 56(84) bytes of data. 64 bytes from 1.0.0.1: icmp_seq=1 ttl=55 tim
by DyslexicAtheist 9y ago
TIL you can also use 1.1 and it will expand to 1.0.0.1
$> ping 1.1
PING 1.1 (1.0.0.1) 56(84) bytes of data.
64 bytes from 1.0.0.1: icmp_seq=1 ttl=55 time=28.3 ms
64 bytes from 1.0.0.1: icmp_seq=2 ttl=55 time=33.0 ms
64 bytes from 1.0.0.1: icmp_seq=3 ttl=55 time=43.6 ms
64 bytes from 1.0.0.1: icmp_seq=4 ttl=55 time=41.7 ms
64 bytes from 1.0.0.1: icmp_seq=5 ttl=55 time=56.5 ms
64 bytes from 1.0.0.1: icmp_seq=6 ttl=55 time=38.4 ms
64 bytes from 1.0.0.1: icmp_seq=7 ttl=55 time=34.8 ms
64 bytes from 1.0.0.1: icmp_seq=8 ttl=55 time=45.7 ms
64 bytes from 1.0.0.1: icmp_seq=9 ttl=55 time=45.2 ms
64 bytes from 1.0.0.1: icmp_seq=10 ttl=55 time=43.1 ms
- tux3 9y agoYou can also use the decimal value of the IP, without the dots: https://16843009 https://16843009
- chisleu 9y agoYou can also sing that number to the tune of the famous 8675309 song with very little robato.
- discreditable 9y agoHex works too: https://0x1010101 https://0x1010101
- notamy 9y agoSadly, binary / octal don't work: https://0b1000000010000000100000001 https://0b1000000010000000100000001 / https://0o100200401 https://0o100200401
- deleted 9y ago[deleted]
- aexaey 9y ago1.2 -> 1.0.0.2 1.2.3 -> 1.2.0.3 But then, much of software would fail here - Firefox/Chrome for example would both threat that as bareword and redirect to search page.
- oneweekwonder 9y agoIt work as expected if you give it the http://1.2.3 http://1.2.3 schema prefix. The input bar is a search bar in modern browsers.
- exikyut 9y agoOr if you follow it with a trailing slash, for less typing 1.1/
- WorldMaker 9y agoOr if you prefix it with // //1.1.1.1 It's one more letter than a suffix, but as a prefix its a bit clearer. I've known companies to post LAN hostname addresses that way, and in written/printed materials it stands out pretty clearly as an address to type. It follows the URL standards (no schema implies current or default schema). Many auto-linking tools (such as a Markdown, Word) recognize it by default (though sometimes results are unpredictable given schema assumptions). It's also increasingly the recommendation for HTML resources where you do want to help insure same-schema requests (good example cross-server/CDN CSS and JS links now are typically written as //css-host.example.com/some/css/file.css).
- dieulot 9y agoThe most useful case for this shortcut is 127.1 -> 127.0.0.1
- avip 9y agoDon't try that in the wild, most sw out there would ignore spec and use some arbitrary regex to validate IP format. i.e python: octets = ip_str.split('.') if len(octets) != 4: raise AddressValueError("Expected 4 octets in %r" % ip_str)
- sigjuice 9y agoWhat spec says that 127.1 and 127.0.0.1 are equivalent?
- nerdwaller 9y agoI don’t actually think it’s in a spec formally but is in a common c lib[0]. > a.b > Part a specifies the first byte of the binary address. Part b is interpreted as a 24-bit value that defines the rightmost three bytes of the binary address. This notation is suitable for specifying (outmoded) Class C network addresses. [0]: https://linux.die.net/man/3/inet_aton https://linux.die.net/man/3/inet_aton
- sigjuice 9y agoThanks. I just came across the man page myself while I was writing this tiny program. $ cat 127.1.c #include <stdio.h> #include <arpa/inet.h> int main(int argc, char *argv[]) { struct in_addr addr; if (inet_aton(argv[1], &addr)) printf("%08x\n", addr.s_addr); return 0; } $ make 127.1 CFLAGS=-Wall cc -Wall 127.1.c -o 127.1 $ ./127.1 1.1 01000001 $ ./127.1 127.1 0100007f
- tzs 9y agoThe POSIX spec (IEEE 1003.1) says the same thing for inet_addr(), so it does occur in an actual spec.
- xtreak29 9y agoInteresting question related to this : https://superuser.com/questions/486788/why-does-pinging-192-168-072-only-2-dots-return-a-response-from-192-168-0-58 https://superuser.com/questions/486788/why-does-pinging-192-...
- deleted 9y ago[deleted]