I answer that old question, I was confronted with this problem and I solved it this way:
For a single domain:
diff <(sort -u <(dig +nottlid +noall +answer @ns.myfirstserver.com example.com ANY) ) <(sort -u <(dig +nottlid +noall +answer @ns.mysecondserver.com example.com ANY) )
For multiple domains or subdomains:
- Create a text file with 1 domain by line (by example: alldomains.txt)
The command line:
diff <(sort -u <(for host in $(cat alldomains.txt); do dig +nottlid +noall +answer @ns.myfirstserver.com $host ANY; done) ) <(sort -u <(for host in $(cat alldomains.txt); do dig +nottlid +noall +answer @ns.mysecondserver.com $host ANY; done) )
Comments:
- diff: compare files line by line
- sort: sort lines of text files
- -u: make sure that there is only unique line
- dig: DNS lookup utility
- +nottlid: do not display the TTL when printing the record
- +noall: clear all display flags
- answer: display the authority section of a reply.
- @ns.server.com: name or IP address of the name server to query
- ANY: indicates what type of query is required (ANY, A, MX, SIG, etc.)
You can redirect to a file by adding > myresult.txt
at end.
I hope this can help someone.
dig
is about as useful a tool as you're going to find for this job. What exactly didn't work? – Celada