DNS Client-Server Exchange
DNS over the Internet
Host names constitute a non-hierarchical namespace. Each name contains a character sequence. The network information center (NIC) manages the namespace and processes new names. The non-hierarchical namespace cannot manage a large number of names for the following reasons:
Names consist of characters, which allows for name overlapping.
The namespace management architecture resides at a specific site. As the number of host names increases, so does the management workload.
The mapping between names and IP addresses frequently changes. Therefore, maintaining the domain namespace is a huge undertaking.
TCP/IP designs a hierarchical DNS structure. The domain name structure of the Internet is defined by the DNS in the TCP/IP protocol stack. The DNS divides the Internet into multiple top-level domains (TLDs). Table 4-1 lists the domain name of each TLD. TLDs are classified in either organization or geography mode. The geography mode is used to classify domain names based on countries. Each country must register a TLD with the NIC before joining the Internet. For example, "cn" represents China, and "us" represents the United States.
TLD |
Meaning |
---|---|
com |
Commercial organizations |
edu |
Educational agencies |
gov |
Governmental agencies |
mil |
Military departments |
net |
Main network support centers |
int |
International organizations |
org |
Other organizations |
country code |
Other countries (classified in geography mode) |
The first seven domains are defined in organization mode, and the country code domain is defined in geography mode.
The NIC authorizes management agencies to classify domains into subdomains. The agencies in charge of this can authorize subordinate agencies to continue classifying domains. As a result, the Internet has a hierarchical domain architecture.
Static Domain Name Resolution
DNS supports dynamic and static domain name resolution. Static domain name resolution is used to resolve a domain name. If it fails, dynamic domain name resolution is used.
Static domain name resolution requires a static domain name resolution table, which lists the mapping created manually between domain names and IP addresses. This table is similar to the hosts file in a Windows 9X. The table contains commonly used domain names. After searching for a specified domain name in the resolution table, clients can obtain the IP address mapped to it. This process improves domain name resolution efficiency.
Dynamic Domain Name Resolution
Dynamic domain name resolution requires a special DNS server. This server runs the domain name resolution program, maps domain names to IP addresses, and collects DNS requests from clients.
The following shows the DNS client-server exchange, which is also the process of dynamic domain name resolution.
In Figure 4-1, the DNS client, consisting of the resolver and the cache, is used to accept and respond to the DNS queries from user programs. Generally, user programs (ping, Tracert), the cache, and the resolver are on the same host; whereas the DNS server is on another host.
A client uses a specific application, such as ping or Telnet, to send a request to the resolver on the DNS client.
- The device queries a local cache for the required mapping entry. The resolver first check the local cache.
- If the resolver finds a mapping entry in the local cache, it directly returns the IP address mapping the domain name to the user program.
- If the resolver does not find a mapping entry in the local cache, it sends a query packet to the DNS server.
The DNS server first checks whether the requested domain name is within the sub-domain it manages and responds to the device according to different results.
- If the requested domain name is within the sub-domain it manages, this DNS server query the IP address corresponding to the domain name in its own database.
- If the requested domain name is not within the sub-domain it manages, this DNS server forward the request to the DNS server of the upper level till the resolution is finished and the result of resolution is returned.
The resolver of the DNS client receives and resolves the packet returned by the DNS server, and return the result to the user program.
When resolving a domain name that is stored in the cache, the DNS client obtains the corresponding IP address from the cache directly and does not send a query message to the DNS server. Mappings stored in the cache will be deleted when the aging time expires to ensure that the latest mappings can be obtained from the DNS server. The aging time is set by the DNS server. The DNS client obtains the aging time from protocol packets.
Domain Name Suffix List
Dynamic domain name resolution also supports a domain name suffix list. Pre-defining some domain name suffixes allows you to enter only a field of a domain name to be resolved. The system automatically adds a specific suffix to the domain name before resolving the domain name.
For instance, If you configure "com" in the suffix list and enter "example" in a domain name query, the system automatically associates "example" with the suffix "com" and searches for "example.com."
You may encounter the following situations during a resolution process:
If you enter a domain name without a dot (.), such as "example", the system considers it as a host name and adds suffixes one by one used for search. If there are no matched domain names, the system searches for an IP address mapped to "example."
If you enter a domain name with a dot (.), such as "www.example", the system immediately searches for it. If the system does not find a matched entry, the system adds every configured suffix to the domain name to search for an IP address mapped to the domain name.
If you enter a domain name with a dot (.) at the end, such as "example.com.", the system removes the last dot (.) before searching for an IP address mapped to the domain name. If the search fails, the system adds every configured suffix to the domain name without the last dot to search for an IP address mapped to the domain name. Note that the original domain name is used for matching static DNS entries.
Query Type of DNS
Class-A query is a common type of query, which is used to obtain the IP address corresponding to a specified domain name. For example, when you ping or tracert a domain name, the ping or tracert, as a user program, sends a query to the DNS client for the IP address corresponding to the domain name. If the corresponding IP address does not exist on the DNS client, the DNS client sends a Class-A query to the DNS server to obtain the corresponding IP address.
- PTR query means that the DNS client obtains the corresponding domain name with the help of PTR records of the according to the IP address. The PTR records means the table of the mapping between the domain names and the IP addresses on the DNS server provided to PRT query.