How ZONE Works
ZONE maintains a list of domains and their servers and a flag indicating whether information for a domain has been successfully loaded from one of the servers. Because of another bug in BIND, ZONE must be primed with a list of all the top-level domains and their name servers. It then cycles through the domain list, attempting to contact one of the servers for each domain not yet transferred. When a server is contacted (via TCP), a Start of Authority (SOA) query is first sent to make sure the server is authoritative for the domain being requested. If so, then a zone transfer query (AXFR) is sent to request all the resource records for the domain to be retrieved.
When a name server record (NS) is received, the referenced domain and server are added to the list of domains to process. When host records (A, CNAME, HINFO, MX) are received, they are added to an in-core table of host information. The program ends when it has cycled through the entire list of domains without receiving any new information. It then dumps the table of host information to a HOSTS.TXT format file.