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.

Zoredache
  • 130,897
  • 41
  • 276
  • 420

3 Answers3

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.

Alnitak
  • 21,191
  • 3
  • 52
  • 82
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.

1

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

Zoredache
  • 130,897
  • 41
  • 276
  • 420
chris
  • 11,944
  • 6
  • 42
  • 51