Sample Header Ad - 728x90

How does dig find my WAN-IP-address? What is "myip.opendns.com" doing?

31 votes
2 answers
28032 views
I needed to automatically get my own WAN-IP-address from my router. I found this question and, among others, a solution with dig was proposed: dig +short myip.opendns.com @resolver1.opendns.com It works perfectly, but now I want to understand what it is doing. Here is what I (hope to) understand so far (please correct me, if I am wrong): - +short just gives me a short output - @resolver1.opendns.com is the DNS server, which is asked what IP address belongs to the given domain What's not clear to me is myip.opendns.com. If I would write www.spiegel.de instead, I would get the IP address of the domain www.spiegel.de, right? With myip.opendns.com I get the WAN-IP of my router. So is myip.opendns.com just emulating a domain, which is resolved to my router? How does it do it? Where does it get my IP from? And how is it different to what webpages, like e.g., www.wieistmeineip.de, are doing? They also try to get my IP. In the answer of Krinkle on the question I mentioned, it is stated that this "dns-approach" would be better than the "http-approach".  Why is it better and what is the difference? There has to be a difference, because the WAN-IP I get from dig +short myip.opendns.com @resolver1.opendns.com (ip1) is the one I can also see in the web interface of my router, whereas www.wieistmeineip.de (and other similar sites too) is giving me another IP address (ip2). I could imagine that my ISP is using some kind of sub-LAN, so that my requests to webservers are going through another (ISP-) router which has ip2, so that www.wieistmeineip.de is just seeing this address (ip2). But, again, what is myip.opendns.com doing then? Additionally: Opening ip1 from within my LAN is giving me the test website from my RasPi, opening it from the outside of my LAN (mobile internet) does not work. Does it mean, that ip1 is no proper "internet IP" but more like a LAN IP?
Asked by Beate Bier (413 rep)
Jan 6, 2017, 01:50 PM
Last activity: Jun 9, 2022, 11:52 AM