0

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.

1
  • 1
    Warning, a DNS-based solution may give you the IP address of your resolver, not of your computer...
    – bortzmeyer
    Oct 11, 2010 at 14:04

3 Answers 3

1

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

1
  • Nope, I wasn't aware that. That looks promising.
    – Zoredache
    Jul 14, 2010 at 1:14
2

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.

1

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.

2
  • A A or AAAA RR cannot be considered as "non standard".
    – bortzmeyer
    Oct 11, 2010 at 14:02
  • +1 for STUN, though, which is indeed the proper solution.
    – bortzmeyer
    Oct 11, 2010 at 14:04

Not the answer you're looking for? Browse other questions tagged .