Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

OpenDNS has a resource record setup so if you request that record it will return the IP address (ref).

So you can use a command like this host myip.opendns.com 208.67.222.222 and the result you will get will be the IP address of computer you are using, or the public address used by the NAT you are behind.

What I would like to know is if there are any open source DNS servers that can perform this function as well.

share|improve this question
1  
Warning, a DNS-based solution may give you the IP address of your resolver, not of your computer... –  bortzmeyer Oct 11 '10 at 14:04
add comment

3 Answers

up vote 1 down vote accepted

Have you looked into PowerDNS and the "pipe" backend?

share|improve this answer
    
Nope, I wasn't aware that. That looks promising. –  Zoredache Jul 14 '10 at 1:14
add comment

There's a plugin in my evldns framework that can do this.

The chaos demo will answer for queries for client.bind with the client's IP address, in either A, AAAA or TXT format as applicable.

share|improve this answer
add comment

That's a non-standard RR. If you want to do something more-or-less portable, take a look at the STUN protocol. It's pretty ghastly but at least it's standard and was designed specifically for the purpose of allowing a host to discover its own IP address and port, as seen by a STUN server. There are public STUN servers available, listed here: http://www.voip-info.org/wiki/view/STUN. The same web page has pointers to client libraries and server software.

The advantage of the DNS-based approach is that you can use tools you've already got. But because it's non-standard it's not portable.

share|improve this answer
    
A A or AAAA RR cannot be considered as "non standard". –  bortzmeyer Oct 11 '10 at 14:02
    
+1 for STUN, though, which is indeed the proper solution. –  bortzmeyer Oct 11 '10 at 14:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.