Hacker News new | ask | show | jobs
by nvr219 2183 days ago
I just use an alias

   myip is aliased to `dig +short myip.opendns.com @resolver1.opendns.com'
2 comments

I do the same! Only catch is, doesn't always work if you're on a restrictive network that only allows udp/53 to a specific DNS (captive portals, corpnets etc). I use a small shell script that tries the DNS trick first, then falls back on HTTP if that times out.
Nice. I like the curl thing because I can hop any any server and not have to worry if I setup an alias or not....I got a lot of servers I am constantly on.