10

I need to move some domains to a different DNS server, and I'm wondering if there's any way to obtain a complete copy of the zone file without going though the current DNS provider?

16

I agree w/ David re: most servers not being configured to allow zone transfers. Having said that, you can try giving a zone transfer a shot.

dig @nameserver example.com axfr

Substitute in your nameserver's name and your domain name.

On Windows, you can use nslookup in interactive mode to do a zone transfer. From the nslookup prompt:

server nameserver
ls -d example.com

Again, substitute in your nameserver's name and your domain name.

Try all the nameservers-- sometimes I find that one of them will allow zone transfers.

1
  • ls -d example.com would shows all just like dig axfr – Nick Tsai Apr 19 '18 at 8:23
6

Generally not.

If the DNS servers are configured to allow zone transfers to anywhere then you can read the whole zone file that way - but it is very unusual for servers to honour such requests unless they are from the providers other name servers or admin/monitoring machines.

2
  • I wonder why DNS wasn't designed as a fully open system, without barriers like that. Really, by now the whole Internet really ought to be like that, where ISP's aren't even necessary because the whole thing is just open. – flarn2006 Jul 24 '18 at 16:52
  • @flarn2006 "I wonder why DNS wasn't designed as a fully open system" It is. But why do you need to full content of a zone? Only secondaries authoritative nameservers need to synchronize with the primary one, and AXFR is one way. But what are use cases of other clients for this data? It poses privacy questions as some records in a zonefile can provide personally identifiable data... "where ISP's aren't even necessary" yeah right and then how do you connect to the Internet? – Patrick Mevzek Jan 10 '20 at 16:26
6

You can list DNS servers using any DNS client nslookup, host, dig ... with dig run


dig domain.tld ns
If the DNS server allow the tranfert zone that is used generally for DNS database replication and backup, you can get the zone file using the dig utility like this:

dig @dns.server domain.tld axfr

2
  • That last command line worked great. From the docs, it sounded like you had to do dig -t AXFR domain.tld which seemed really strange to me. – Alexis Wilke Sep 2 '16 at 20:21
  • This works well when running locally on your own server and you want a quick list of resource records configured for that zone. – Anthony Geoghegan Apr 4 '17 at 14:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.