BIND zone file output with DIG command?

Solution 1:

Zone transfer using dig:

dig @server domain axfr

Where server is the server to query, and domain is the domain name to request the zone for

This won't work unless you are authorized to perform a zone transfer, which is highly unlikely unless it is your name server.

Solution 2:

If you are asking whether one can use dig to get a dump of all records in a zone file, then the answer is yes, but very tentatively.

The only way to make a BIND server dump all data in a zone is by using a zone transfer, this can be specified with the request type AXFR. However, since most BIND DNS servers will only transfer zones to explicitly specified hosts, you are very unlikely to find a public DNS server that will respond to this request.

Solution 3:

You could try dig -tAXFR zone.tld where zone.tld is the name of the zone you want to see e.g.

dig -tAXFR lan 

dumps the .lan domain I have.