How to find out DNS ?

Steve Holden sholden at holdenweb.com
Mon Jul 1 10:45:36 EDT 2002


"Matthew Sherborne" <miracle at paradise.net.nz> wrote ...
> There is a way but it's very hard. You take a list of root dns servers,
> you get your local host name, (gethostbyaddr(youripaddress)), you remove
> from it the computer name, so you've just got the domain name. Then
> taking a list of "root" dns servers, you ask one of them, what's the dns
> server for this domain?
>
> It'l l say "I don't know, ask server X" then you ask server X, which
> will be a closer server to your host than the root server. You keep on
> going until one of the servers says "yes, This is/I am  your server"
> then that's your dns server.
>
> You can do this with  the code in http://pydns.sf.net.
>
> Is it an open-source project you're working on? I might take an interest
:)
>

In actual fact  you could usually get the same answer by going to *any* DNS
server and asking "what is the DNS server from domain xxx.yyy.zzz" using a
query for NS resource records. Let the DNS do the work like it's supposed
to! Further, this technique will tell you which DNS server is serving the
domain of which your workstation is a member, but that need not be "The
primary or secondary DNS [server] I use when connecting to internet" as
asked by the OP.

For example, if you look up the DNS server for holdenweb.com, you will *not*
find 10.0.0.1 as any kind of DNS server, even though that is the IP address
that all machines behind my firewall use as their principal DNS server.

Domains often "split" their DNS service, offering a private and complete
domain description behind the firewall, and a limited public version
containing only the hosts that are intended to be publicly available. Also I
get the advantage of behind-the-firewall caching, so DNS traffic to external
servers is minimized, retaining Internet bandwidth for more practical
purposes.

regards
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
----------------------------------------------------------------------








More information about the Python-list mailing list