1

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?

1 Answer 1

2

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.

2
  • 1
    host is considered obsolete by its authors. dig is preferred.
    – Alnitak
    Sep 19, 2010 at 20:37
  • Ah, I didn't know that. I love host though.. Sep 20, 2010 at 6:23

You must log in to answer this question.

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