"Computer Network" Domain Name System (DNS)

The domain name system is a naming system used on the Internet to convert host names with specific meanings that are easy for people to remember into IP addresses that are easy to handle. Compared with IP addresses, people prefer to use strings with specific meanings to identify computers on the Internet. It is worth noting that the DNS system adopts the C/S architecture, and its protocol runs on UDP and uses port 53.

Conceptually, DNS can be divided into three parts: hierarchical domain name space, domain name server and resolver

1. Hierarchical Domain Name Space

Insert picture description here

2. Domain Name Server

There are many DNS servers, which are divided into three layers according to the hierarchical structure, the root domain name server, the top domain name server, and the authority domain name server

The local domain name server is not considered a hierarchical structure. It is characterized by being relatively close to the host. When the host communicates with another host that is relatively close, there is no need to go to higher-level servers.

The root domain name server is not only one for a domain name, but one domain name corresponds to multiple domain name servers. There are 13 such domain names in the world, namely a.rootservers.net, b.rootservers.net, and c.rootservers.net , … \Cdots, m.rootservers.net

In the authority domain name server, although it seems that abc.com has one less place than y.abc.com, their status is still equal , corresponding to the two authority domain name servers

Insert picture description here

3. Domain name resolution process

Insert picture description here

3.1 Recursive query

The host first sends a request to the local domain name server, if it cannot be found,

The local domain name server sends a request to the root domain name server (to find someone else), if it still cannot be found

The root domain name server sends a request to the top-level domain name server (to find someone else), if it still cannot be found

The top-level domain name server sends a request to the authority domain name server (look for someone else)

You can see that the server for the next query has changed every time. The host does not ask one by one, but the server asks one by one.

3.2 Iterative query

The host first sends a request to the local domain name server, if it cannot be found,

The local domain name server will let the host send a request to the root domain name server (the host will find it, and the local domain name will give the IP address of the target root domain name server). If it still cannot be found,

The root domain name server allows the host to send a request to the corresponding top-level domain name server (the host finds it, and the root domain name gives the IP address of the target top-level domain name server). If it still cannot be found,

The top-level domain name server allows the host to send a request to the authority domain name server (the host goes to find, the top-level domain name gives the IP address of the target authority domain name server)

You can see here is the address of the host asking one by one

3.3 Cache

In order to reduce the resource waste of querying the same domain name multiple times, the local domain name server will store the most recently used ip address resolution, so you don't need so many query steps when you visit the same domain name next time. At the same time, the cache host itself also has storage

At the same time, the local domain name server can also cache the addresses of the top-level domain name server and the authority domain name server. The next time even if it is an unknown IP address, the query can be faster.

In order to maintain the correctness of the cache, it needs to be updated regularly

Guess you like

Origin blog.csdn.net/dreaming_coder/article/details/114067258