Types of DNS: Recursive, Iterative, Authoritative
The major difference between recursive, iterative, and authoritative DNS queries lies in how they handle the resolution process. Recursive queries involve a server that fully resolves the query on behalf of the client, while iterative queries require the client to contact multiple servers. Authoritative queries are responses from DNS servers that hold the definitive data for a domain, and are used to provide IP addresses to recursive resolvers.
Recursive
The client (your computer) sends a query to a recursive DNS server. The recursive server then performs the necessary lookups to find the answer, potentially contacting other DNS servers in the process. The recursive server caches the result and sends it back to the client. This approach is more convenient for the client, as it doesn't need to manage the query process itself.
Iterative
The client sends a query to a DNS server. The server may or may not have the answer. If it doesn't, it provides the client with the addresses of other DNS servers that might have the answer. The client then needs to query these other servers, potentially repeating the process until the answer is found. This approach requires more active client involvement, but can be more efficient in certain scenarios.
Authoritative
Authoritative DNS servers hold the definitive DNS data for a domain (e.g., the IP address of a website). They respond to both recursive and iterative queries with the requested information. They are the source of truth for DNS data within a domain.
Back to code!