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.

I would like to compare two DNS entries.
One from DNS service provider A, and one from DNS service provider B.

Is there a tool to extract the DNS entry for mydomain.com from a nameserver?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

It really depends what your DNS provider allows you to do. You can do a simple lookup for records (A, MX, NS, etc) with "host" or "nslookup":

$ host www.mydomain.com
www.mydomain has address 12.34.56.78

$ host -t ns mydomain.com
mydomain.com name server ns1.mydomain.com.
mydomain.com name server ns2.mydomain.com.

If you just want to compare single entries, you can use "host" against different nameservers:

$ host www.mydomain.com ns1.mydomain.com.

and

$ host www.mydomain.com ns2.mydomain.com.

Or use "dig" that gives you an more info about your domain and in a bind zone file format

$ dig www.mydomain.com

; <<>> DiG 9.6.0-APPLE-P2 <<>> www.mydomain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27232
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 0

;; QUESTION SECTION:
;www.mydomain.com.                  IN      A

;; ANSWER SECTION:
www.mydomain.com.           600     IN      A       12.34.56.78

;; AUTHORITY SECTION:  
mydomain.com.               600     IN      NS      ns1.mydomain.com.
mydomain.com.               600     IN      NS      ns2.mydomain.com.

Dig takes the nameserver you want to query in the form of "@nameserver":

$ dig @ns1.mydomain.com www.mydomain.com

If your DNS provider allows zone file transfers (AXFR), you can get the whole zone file with:

$ dig @ns1.mydomain.com AXFR

This will return the complete zone file in a BIND compatible format.

share|improve this answer
1  
host is considered obsolete by its authors. dig is preferred. –  Alnitak Sep 19 '10 at 20:37
    
Ah, I didn't know that. I love host though.. –  Wouter de Bie Sep 20 '10 at 6:23

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.