by lxgr · 1y ago · 0 comments
Rest in peace!
Edit: All these (great and much appreciated!) responses of alternatives are making me wonder if this should in fact be a standardized service that could then be offered as a public good in a similar way as pool.ntp.org.
Checking for generic Internet connectivity (i.e. not only having an IP address, but being able to reach public sites, these sites being non-cached, not-captive-portaled etc.) seems like a problem that too many apps, scripts, and devices are solving again and again.
I do like the curl-ability of that one a lot, though, and on my own computer I can just configure an alias or shell function for it :)
You can `curl https://ipinfo.io/` and get a JSON blob back with info on your current IP. If you pass an IP explicitly you can get info back on it, for example `curl https://ipinfo.io/104.26.7.98`. Easy to combine with jq also for use in scripts: `curl https://ipinfo.io/104.26.7.98 | jq -r '.ip'`
For personal use it's free, and they have reasonable pricing for large volume. No affiliation on my part, just a happy user.
This API endpoint has its dedicated stack and infrastructure to support unlimited lookups.
Also, for IPv6 connection use: https://v6.ipinfo.io/ip
PS: I am the DevRel of IPinfo.
I highly recommend you check out the page: https://ipinfo.io/myip
I understand the data we have for your IP address is not front and center anymore. We have gone through several iterations of designs for our homepage, so if you have any suggestions, I will relay them to our team.
[0] https://blog.apnic.net/2021/06/17/how-a-small-free-ip-tool-s...
Don’t have the command on hand but easily searchable
dig +short -4 myip.opendns.com @resolver1.opendns.com
(still an external service, but not reliant on a website)DNS also runs a higher risk of being cached or mangled somewhere along the way by middleboxes. HTTPS avoids that problem.
Cloudflare: https://ipv4.icanhazip.com + https://ipv6.icanhazip.com
Akamai: https://ipv4.whatismyip.akamai.com + https://ipv6.whatismyip.akamai.com
The problem with https://checkip.amazonaws.com is that it neither supports IPv6, nor claims that it will remain IPv4-only, so it's not clear what you'll get in the future.