172<<24 + 217<<16 + 23<<8 + 110 = 2899908462
Saves 4 whole keystrokes if you quickly want to ping something to test connectivity.
So if you own some 31.x block, you could have a phone number which matches your IP.
[0] https://en.wikipedia.org/wiki/Universal_Personal_Telecommuni...
The US phone system had such a service for a few years (area code 500 iirc). It had so little uptake that it was shut down.
I think I'm wrong, it was about the 10-digit Dutch numbers.
#!/bin/ksh
Die() {
echo Bad IP
exit 1
}
[ $# = 1 ] || Die
[ ${1%%?*.?*.?*.?*} ] && Die
I=$1
until [ ${#I} = 0 ]
do
J=${I#[0-9.]}
[ ${#I} = ${#J} ] && Die
I=$J
done
I=$1.
typeset -ui N=0
while [ $I ]
do
J=${I%%.*}
I=${I#$J.}
[ $((J>>8)) = 0 ] || Die
N=$(( (N<<8) + J ))
done
echo $N
# End man inet_aton
[…] int inet_aton(const char *cp, struct in_addr *inp)
[…]
The address supplied in cp can have one of the following forms:
[…]
a The value a is interpreted as a 32-bit value that is stored
directly into the binary address without any byte rearrangement.
https://manpages.debian.org/stable/manpages-dev/inet_aton.3....https://www.lookip.net/ip/172.217.23.110
Funny I wasn't aware of this despite 25 years of being an Internet user
You're not alone… I been using the Internet longer'n that and I didn't ever think of converting an IP address to a decimal number either. It makes perfect sense now that it's been pointed out, but for some reason it just never crossed my mind to even try it.
The "special" case is supporting network addresses to be written as 10.2932832 ("convenient" for class A's), 172.16.61031 (ditto for B's), or just one big address like 39282329, when we're used to 4 octets separated by dots.
Not every bit of host software supports these cases anymore, as basically their sole remaining use case is as a curiosity or to circumvent bad security controls.
And it is a regular ip address, just written differently :)