DNS principle and parsing process V

Source: Internet
Author: User
Tags reserved alphanumeric characters browser cache domain name registration domain server fully qualified domain name

This article mainly refers to from: http://369369.blog.51cto.com/319630/812889 and made a small change

What is DNS.

Hosts on the internet, like humans, can be identified in a variety of ways. A host's identification method is to use its host name (hostname), such as CNN.com, www.baidu.com, etc., but the host name provides little information about the location of the host in the Internet. (a host named www.eurecom.fr ends with a country code. FR, tells us that the host is likely to be in France, that's all.) In addition, routers are difficult to handle because the host name may consist of alphanumeric characters. For these reasons, the host can also use the so-called IP address for identification.


DNS (domain Name System) is the abbreviation for the name systems, a computer and network service naming system that is organized into a domain hierarchy that is used by TCP/IP networks and provides services for converting host names and domain names to IP addresses. DNS is such a "translation officer", its basic principle of work can be shown in the following figure.

As with HTTP, FTP, and SMTP protocols, the DNS protocol is the application-tier protocol, because: 1. Use the client/server mode to run between the communication's end systems, 2. Transfer DNS messages between the communicating end systems through the following End-to-end Transport layer protocol. DNS running on top of UDP, using the port number is.

DNS domain name
As a hierarchical and distributed database, the domain Name system contains various types of data, including host names and domain names. The name in the DNS database forms a hierarchical tree structure called the domain namespace. The domain name contains a single label divider, for example: im.qq.com.
The fully qualified domain name (FQDN) uniquely identifies the location of the host in the DNS hierarchy tree, separating the list of names of hosts referenced from the root by the specified path. The following illustration shows an example of a host called the qq.com DNS tree in IM. The FQDN of the host is im.qq.com.
Name hierarchy for DNS domains

How to organize DNS domain name space
A description of the five categories used to describe the DNS domain name in its functional namespace is described in the following table, along with an example of each name type.

DNS and Internet domains
The Internet Domain name registration Authority is responsible for maintaining the allocation of the top-level domain of the organization and the country/region for management on the Internet. These domain names are in accordance with international standards 3166. Some of the existing abbreviations, reserved for use in the organization, as well as two-letter and three-letter countries/regions, are shown in the following table. Some common DNS domain names are described in the following illustration:

Resource records
Resource records (RRs) that are contained in the DNS database. Each RR identifies a specific resource in the database. When we set up a DNS server, we often use records such as Soa,ns,a, and Mx,cname records are used when maintaining DNS servers.
Common RRs are shown in the following figure:

The work process of the DNS service
When a DNS client needs to query the name used in a program, it queries the local DNS server to resolve the name. Each query message sent by the client includes 3 messages to specify the question the server should answer.
The specified DNS domain name, which is represented as a fully qualified domain name (FQDN).
The specified query type, which can specify resource records based on type or as a specialized type of query operation.
The specified category for the DNS domain name.
For DNS servers, it should always be specified as an Internet category. For example, the specified name can be a fully qualified domain name for the computer, such as im.qq.com, and the specified query type is used to search for an address resource record through that name.
DNS queries are parsed in a variety of different ways. Clients can sometimes answer queries in place by using cached information obtained from a previous query. The DNS server can use its own resource record information cache to answer queries, or to query or contact other DNS servers on behalf of the requesting client, to fully resolve the name, and then return the answer to the client. This process is called recursion.
In addition, the client itself can try to contact other DNS servers to resolve the name. If the client does so, it uses a separate and additional query based on the server answer, called an iteration, that is, the interactive query between DNS servers is an iterative query.
The procedure for DNS queries is shown in the following illustration.

1, in the browser to enter the www.qq.com domain name, the browser will first find in their own cache whether the domain name corresponding to the IP address (if you have visited the domain name and there is no empty cache exists).

2, when the browser cache does not have a domain name corresponding to IP when the operating system will first check their own local Hosts file has this URL mapping relationship, if so, the first call this IP address mapping, complete domain name resolution.

3, if the hosts do not have this domain name mapping, then look for the local DNS parser cache, whether there is this URL mapping relationship, if any, direct return, complete the domain name resolution.

4, if the hosts and the local DNS resolver cache have no corresponding URL mapping relationship, first find the TCP/IP parameters set in the preferred DNS server, where we call it a local DNS server, when the server receives a query, if the domain name to query, included in the Local Configuration zone resources, Then return the result to the client, complete the domain name resolution, this resolution is authoritative.

5, if you want to query the domain name, not by the local DNS server zone resolution, but the server has cached this URL mapping relationship, then call this IP address mapping, complete domain name resolution, this resolution does not have authority.

6, if the local DNS server local zone file and cache resolution are invalid, queries are based on the local DNS server's settings (whether to set up forwarders), and if the forwarding mode is not used, local DNS sends the request to 13 root DNS, and the root DNS server determines the domain name (. com) when it receives the request. Who is authorized to administer and will return an IP that is responsible for the top-level domain server. When the local DNS server receives IP information, it will contact this server responsible for the. com domain. When the server that is responsible for the. com domain receives the request, if it cannot resolve it, it will find a next-level DNS server address (qq.com) to the local DNS server that manages the. com domain. When the local DNS server receives this address, it finds the qq.com domain server, repeats the above action, and queries until the www.qq.com host is found.

7, if the use of forwarding mode, the DNS server will forward the request to the first level of DNS server, by the previous server to resolve, if the server can not be resolved, or to find root DNS or transfer requests to the superior, to this cycle. Whether the local DNS server is forwarded or root prompted, the result is returned to the local DNS server, which is then returned to the client.

The client to the local DNS server is a recursive query, and the interactive query between DNS servers is the iterative query.

DNS Cache

In fact, in order to improve time delay performance and reduce the number of DNS messages that are transmitted around the Internet, DNS has extensively experimented with caching techniques. The principle of DNS caching is simple. In the request chain, when a DNS server receives a DNS answer, the DNS server can cache the information in the answer in the local storage. If a host name/IP address pair is cached in the DNS server, and another query to the same host name arrives at the DNS server, the server is able to provide the required IP. Because the mappings between host and host names and IP addresses are never permanent, the DNS server will discard cached information after a period of time (typically set to two days).

This article mainly refers to from: http://369369.blog.51cto.com/319630/812889 and made a small change

What is DNS.

Hosts on the internet, like humans, can be identified in a variety of ways. A host's identification method is to use its host name (hostname), such as CNN.com, www.baidu.com, etc., but the host name provides little information about the location of the host in the Internet. (a host named www.eurecom.fr ends with a country code. FR, tells us that the host is likely to be in France, that's all.) In addition, routers are difficult to handle because the host name may consist of alphanumeric characters. For these reasons, the host can also use the so-called IP address for identification.


DNS (domain Name System) is the abbreviation for the name systems, a computer and network service naming system that is organized into a domain hierarchy that is used by TCP/IP networks and provides services for converting host names and domain names to IP addresses. DNS is such a "translation officer", its basic principle of work can be shown in the following figure.

As with HTTP, FTP, and SMTP protocols, the DNS protocol is the application-tier protocol, because: 1. Use the client/server mode to run between the communication's end systems, 2. Transfer DNS messages between the communicating end systems through the following End-to-end Transport layer protocol. DNS running on top of UDP, using the port number is.

DNS domain name
As a hierarchical and distributed database, the domain Name system contains various types of data, including host names and domain names. The name in the DNS database forms a hierarchical tree structure called the domain namespace. The domain name contains a single label divider, for example: im.qq.com.
The fully qualified domain name (FQDN) uniquely identifies the location of the host in the DNS hierarchy tree, separating the list of names of hosts referenced from the root by the specified path. The following illustration shows an example of a host called the qq.com DNS tree in IM. The FQDN of the host is im.qq.com.
Name hierarchy for DNS domains

How to organize DNS domain name space
A description of the five categories used to describe the DNS domain name in its functional namespace is described in the following table, along with an example of each name type.

DNS and Internet domains
The Internet Domain name registration Authority is responsible for maintaining the allocation of the top-level domain of the organization and the country/region for management on the Internet. These domain names are in accordance with international standards 3166. Some of the existing abbreviations, reserved for use in the organization, as well as two-letter and three-letter countries/regions, are shown in the following table. Some common DNS domain names are described in the following illustration:

Resource records
Resource records (RRs) that are contained in the DNS database. Each RR identifies a specific resource in the database. When we set up a DNS server, we often use records such as Soa,ns,a, and Mx,cname records are used when maintaining DNS servers.
Common RRs are shown in the following figure:

The work process of the DNS service
When a DNS client needs to query the name used in a program, it queries the local DNS server to resolve the name. Each query message sent by the client includes 3 messages to specify the question the server should answer.
The specified DNS domain name, which is represented as a fully qualified domain name (FQDN).
The specified query type, which can specify resource records based on type or as a specialized type of query operation.
The specified category for the DNS domain name.
For DNS servers, it should always be specified as an Internet category. For example, the specified name can be a fully qualified domain name for the computer, such as im.qq.com, and the specified query type is used to search for an address resource record through that name.
DNS queries are parsed in a variety of different ways. Clients can sometimes answer queries in place by using cached information obtained from a previous query. The DNS server can use its own resource record information cache to answer queries, or to query or contact other DNS servers on behalf of the requesting client, to fully resolve the name, and then return the answer to the client. This process is called recursion.
In addition, the client itself can try to contact other DNS servers to resolve the name. If the client does so, it uses a separate and additional query based on the server answer, called an iteration, that is, the interactive query between DNS servers is an iterative query.
The procedure for DNS queries is shown in the following illustration.

1, in the browser to enter the www.qq.com domain name, the browser will first find in their own cache whether the domain name corresponding to the IP address (if you have visited the domain name and there is no empty cache exists).

2, when the browser cache does not have a domain name corresponding to IP when the operating system will first check their own local Hosts file has this URL mapping relationship, if so, the first call this IP address mapping, complete domain name resolution.

3, if the hosts do not have this domain name mapping, then look for the local DNS parser cache, whether there is this URL mapping relationship, if any, direct return, complete the domain name resolution.

4, if the hosts and the local DNS resolver cache have no corresponding URL mapping relationship, first find the TCP/IP parameters set in the preferred DNS server, where we call it a local DNS server, when the server receives a query, if the domain name to query, included in the Local Configuration zone resources, Then return the result to the client, complete the domain name resolution, this resolution is authoritative.

5, if you want to query the domain name, not by the local DNS server zone resolution, but the server has cached this URL mapping relationship, then call this IP address mapping, complete domain name resolution, this resolution does not have authority.

6, if the local DNS server local zone file and cache resolution are invalid, queries are based on the local DNS server's settings (whether to set up forwarders), and if the forwarding mode is not used, local DNS sends the request to 13 root DNS, and the root DNS server determines the domain name (. com) when it receives the request. Who is authorized to administer and will return an IP that is responsible for the top-level domain server. When the local DNS server receives IP information, it will contact this server responsible for the. com domain. When the server that is responsible for the. com domain receives the request, if it cannot resolve it, it will find a next-level DNS server address (qq.com) to the local DNS server that manages the. com domain. When the local DNS server receives this address, it finds the qq.com domain server, repeats the above action, and queries until the www.qq.com host is found.

7, if the use of forwarding mode, the DNS server will forward the request to the first level of DNS server, by the previous server to resolve, if the server can not be resolved, or to find root DNS or transfer requests to the superior, to this cycle. Whether the local DNS server is forwarded or root prompted, the result is returned to the local DNS server, which is then returned to the client.

The client to the local DNS server is a recursive query, and the interactive query between DNS servers is the iterative query.

DNS Cache

In fact, in order to improve time delay performance and reduce the number of DNS messages that are transmitted around the Internet, DNS has extensively experimented with caching techniques. The principle of DNS caching is simple. In the request chain, when a DNS server receives a DNS answer, the DNS server can cache the information in the answer in the local storage. If a host name/IP address pair is cached in the DNS server, and another query to the same host name arrives at the DNS server, the server is able to provide the required IP. Because the mappings between host and host names and IP addresses are never permanent, the DNS server will discard cached information after a period of time (typically set to two days).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.