Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This reminds me of a neat little trick I used back then to "reliably" compute IP address of my machines for a dynamic DNS utility I wrote for myself.

OpenDNS resolvers (such as resolver1.opendns.com) will resolve myip.opendns.com to your actual IP address. Whether you get A or AAAA records depends on your connection. Since the IP addresses for these resolvers tend to be anycast IPs, I also want to believe they are marginally faster than pinging some central HTTP service that can go down at any time. (Of course, OpenDNS can vanish at any time, too, but I find the risk of that more tolerable than the countless "what is my IP address?" HTTP services out there)

Anyway, I remember hearing before that DNS originally was intended to be used with a broader scope of data than just domain names (hence the existence of TXT records and the like). This website greatly demonstrates how much utility you can get out of DNS.



Google and akamai also has a DNS service.

    dig @ns1-1.akamaitech.net ANY whoami.akamai.net +short


    dig @ns1.google.com TXT o-o.myaddr.l.google.com +short


On Windows:

    nslookup whoami.akamai.net ns1-1.akamaitech.net


What's more likely to go down. OpenDNS or YouTube.

    curl -4si0A "" https://www.youtube.com|sed -n '/ip=/{s/.*ip=//;s/\.*//p;};'|uniq
What's more likely to go down. OpenDNS or Cloudflare.

This will work with any Cloudflare IP address and it does not even require TLS.

    printf 'GET /cdn-cgi/trace HTTP/1.0\r\nHost: cloudflare.com |nc -vvn  104.18.25.13 80 |sed -n /ip=/p
To get list of Cloudflare IPs

    curl -4si0A ""  https://api.cloudflare.com/client/v4/ips
There are many, many websites that print the client IP address in a webpage or in a HTTP head. Not necessarily "What is my IP" websites. No need to rely on just one source.

Websites that use Cloudlfare to block certain requests are another option. For example, StackOverflow. Just send HTTP request without User-Agent header.

     curl -si40A "" http://stackoverflow.com|sed -n '/cf-footer-ip">/{s/.*">//;s/<.*//p;}'
The success of "What is my IP" websites is quite surprising given that one's IP address is displayed by hundreds of thousands of other websites.

Further reading on utility of DNS

https://www.netmeister.org/blog/dns-rrs.html


You have a good point that most of those HTTP services out there for getting your IP don't seem like they would be particularly reliable in terms of uptime.

Worth noting that Cloudflare run one though, and that seems more likely to be reliable:

https://icanhazip.com/

https://ipv4.icanhazip.com/

https://ipv6.icanhazip.com/


Very nice idea. Seems way simpler than the STUN protocol.


I worked on VoIP before RFC3489. We built our own ways to handle NAT and firewalls, but it always involved something like a directory server that would see both your private and public IPs and share information between clients at call time to connect calls.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: