Way to Query to DNS ?
The major task carried out by a DNS server is to respond to queries (questions) from a local or remote resolver or other DNS acting on behalf of a resolver. A query would be something like 'what is the IP address of fourm.infoporch.com'.A DNS server may receive such a query for any domain. DNS servers may be configured to be authoritative for some domains, slaves for others, forward queries or other combinations.
Most of the queries that a DNS server will receive will be for domains for which it has no knowledge, that is, for which it has no local zone files. DNS software typically allows the name server to respond in different ways to queries about which it has no knowledge.
There are three types of queries defined for DNS:
-
A recursive query - the complete answer to the question is always returned. DNS servers are not required to support recursive queries.
-
An Iterative (or non-recursive) query - where the complete answer MAY be returned or a referral provided to another DNS. All DNS servers must support Iterative queries.
-
An Inverse query - where the user wants to know the domain name given a resource record. Reverse queries were poorly syupported, very infrequent and are now obsolete (RFC 3425).
Historically reverse IPv4 mapping was not mandatory. Many systems however now use reverse mapping for security and simple authentication schemes (especially mail servers) so proper implementation and maintenance is now practically essential. Further IPv6 mandates reverese mapping.
Recursive Queries
A recursive query is one where the DNS server will fully answer the query (or give an error). DNS servers are not required to support recursive queries and both the resolver (or another DNS acting recursively on behalf of another resolver) negotiate use of recursive service using bits in the query headers.There are three possible responses to a recursive query:
-
The answer to the query accompanied by any CNAME records (aliases) that may be useful. The response will indicate whether the data is authoritative or cached.
-
An error indicating the domain or host does not exist (NXDOMAIN). This response may also contain CNAME records that pointed to the non-existing host.
-
An temporary error indication - for instance, can't access other DNS's due to network error etc..
-
Resolver on a host sends query 'what is the IP address of fourm.infoporch.com' to locally configured DNS server.
-
DNS server looks up fourm.infoporch.com in local tables (its cache) - not found
-
DNS sends query to a root-server for the IP of fourm.infoporch.com.
-
The root-server replies with a referral to the TLD servers for .com
-
The DNS server sends query 'what is the IP address fourm.infoporch.com' to one of the .com TLD servers.
-
The TLD server replies with a referral to the name servers for infoporch.com.
-
The DNS server sends query 'what is the IP address fourm.infoporch.com' to name server for infoporch.com.
-
Zone file defines a CNAME record CNAME record which shows fourm is aliased to joe. DNS returns both the CNAME for fourm and the A record for joe.
-
send response joe=x.x.x.x (with CNAME record fourm=joe) to original client resolver. Transaction complete.
Iterative (non-recursive) Queries
A Iterative (or non-recursive) query is one where the DNS server may provide a partial answer to the query (or give an error). DNS servers must support non-recursive queries.There are four possible responses to a non-recursive query:
-
The answer to the query accompanied by any CNAME records (aliases) that may be useful. The response will indicate whether the data is authoritative or cached.
-
An error indicating the domain or host does not exist (NXDOMAIN). This response may also contain CNAME records that pointed to the non-existing host.
-
An temporary error indication, for instance, can't access other DNS's due to network error etc..
-
A referral: the name and IP addess(es) or one or more name server(s) that are closer to the requested domain name. This may, or may not be, the authoritative name server for the target domain.
-
Resolver on a host sends query 'what is the IP address fourm.infoporch.com' to locally configured DNS server.
-
DNS server looks up fourm.infoporch.com in local tables (its cache) - not found
-
The DNS replies with a referral containing the root-servers
-
Resolver sends query to a root-server for the IP of fourm.infoporch.com
-
The root-server replies with a referral to the TLD servers for .com
-
The Resolver sends query 'what is the IP address fourm.infoporch.com' to .com TLD server.
-
The TLD server replies with a referral to the name servers for infoporch.com
-
The Resolver sends query 'what is the IP address fourm.infoporch.com' to name server for infoporch.com.
-
Zone file defines a CNAME record which shows fourm is aliased to joe. DNS returns both the CNAME and the A record for joe.
-
Transaction complete.
Inverse Queries
Historically an Inverse query maps a resource record to a domain. An example Inverse query would be 'what is the domain name for this MX record'. Inverse query support is optional and it is permitted for the DNS server to return a response Not Implemented.Inverse queries are NOT used to find a host name given an IP address. This process is called Reverse Mapping (Look-up) uses recursive and Iterative (non-recursive) queries with the special domain name IN-ADDR.ARPA. Inverse queries went the way of all "seemed like a good idea at the time" concepts when they were finally obsoleted by RFC 3425.