Uncover the mysterious navigation behind the Internet, DNS domain name resolution

Uncover the mysterious navigation behind the Internet, DNS domain name resolution

In the vast information system of the Internet, DNS (Domain Name System) plays a very competent navigation role. It is like a precise map, guiding users to access the target website accurately.

This article aims to explore in depth the core concepts and operating mechanisms of DNS and its importance in maintaining the efficient operation of the Internet.

The picture below clearly shows the entire process of DNS domain name resolution.

What is DNS

DNS (Domain Name System) is a core component of the Internet, responsible for converting easy-to-remember domain names (such as www.baidu.com) into IP addresses that computers can understand (such as 39.156.66.10). This system enables users to easily access websites and other network resources through a distributed database and multi-level query mechanism, ensuring the normal operation and efficient navigation of the Internet. DNS runs on the UDP protocol and uses port 53.

Domain name structure analysis

As shown in the figure above, the domain name system adopts a hierarchical tree structure. At the top is the root server, and below it are top-level domains (such as .com, .net, and .cn, etc.). Most users register second-level domain names (such as baidu.com), which are managed by companies and their teams. There are also deeper subdomains, but they are not discussed in detail here. Overall, the domain name system is a design that is refined layer by layer from global to local.

DNS resolution process

As shown in the figure above, we will elaborate on the DNS resolution process in detail:

  • When you enter a URL (such as http://www.kwpmp.cn) in a browser on your computer or mobile phone, the browser will first try to find the actual IP address of the website through DNS resolution. If the local cache does not have this information, it will query the root DNS server. The root server will tell the location of the server responsible for the .cn domain name. In this way, you can gradually find the exact location of kwpmp.cn.
  • After the recursive server obtains the address of the authoritative server for .cn, it will ask the authoritative server whether it knows the location of www.kwpmp.cn. Then, the authoritative server for .cn looks up and returns the address of the kwpmp.cn server.
  • Continue to query this address from the authoritative server of kwpmp.cn, and then the server of kwpmp.cn gives the answer: 10.10.10.168.
  • Finally, you can make an http link and successfully access the website.

Once the recursive server finds the resolution record of the domain name, it will save it locally. In this way, the next time a client queries the same domain name, it does not need to search step by step. Because the local server already has a cache, it can directly return the A record of www.kwpmp.cn to the client.

DNS resource records

Domain

TTL

Class

Type

rdata

www.kwpmp.cn

600

IN

A

10.10.10.168

When we associate a domain name with its related information, it is called a resource record (RR). For example, when you search for the URL kwpmp.cn, the result will have the following information:

  • TTL: It is the life cycle, which is the length of time the recursive server will keep the resource record in the cache.
  • Network protocol type: Its representative identifier is IN, IN means internet. Currently, the main protocol supported by the DNS system is IN.
  • type: It is the resource record type. Most websites use A records (IPv4 host address).
  • rdata: is resource record data, which is the information data associated with the domain name.

DNS query method

DNS queries mainly use two modes: recursive query and iterative query.

Recursive query

When a client initiates a DNS resolution request, if the local DNS server cannot directly resolve the domain name, it will perform recursive queries on behalf of the client to other DNS servers until an answer is found and returned to the client. During this process, the client will continue to wait for a response.

Iteration query

When a client (lower-level server) initiates a DNS resolution request, if the upper-level DNS server cannot directly provide the resolution result, it will return the IP address of another DNS server that may know the answer. Then, the client will continue to query this new DNS server, repeating this process until the final resolution result is obtained.

Usually, the query between a PC and a local DNS server uses a recursive query. When DNS servers need to query each other, recursive queries are also often used. As shown in the figure below.

How to configure DNS in Linux

DNS is configured in Linux mainly by editing the /etc/resolv.conf file. The following are the configuration steps:

(1) Edit /etc/resolv.conf

Open a terminal and edit the /etc/resolv.conf file using a text editor such as nano or vim:

 sudo nano /etc/resolv.conf

(2) Add a DNS server

Add the address of the DNS server to the file. Commonly used public DNS servers are:

 nameserver 8.8.8.8 nameserver 114.114.114.114

(3) Save and exit

Save the file and exit the editor. If you are using nano, you can press Ctrl + O to save and Ctrl + X to exit.

(4) Test DNS configuration

Use the nslookup or dig command to test whether the DNS resolution is normal:

 nslookup www.baidu.com.com

in conclusion

DNS is an integral part of the Internet. It connects users and network resources in an efficient and reliable way. Understanding how DNS works can help us better manage and maintain network services.

<<:  Illustrated TCP three-way handshake: building a network session step by step

>>:  The speed of light leads the future: Hubei Sports Vocational College upgrades its all-optical network

Recommend

Let's talk about viewing ServiceEntry injection information in Envoy

[[431019]] introduction Istio provides ServiceEnt...

Five ways 5G will change retail

5G is a hot topic - along with Web3.0 and the Met...

The key to making the Internet of Things really take off: wireless charging

From the average suburban home to the factory ass...

Why restarting the router frequently makes WiFi faster

Using WiFi to surf the Internet has become an ind...

Is your network AI as smart as you think?

[[418239]] Network operators tell me that in the ...

What role does Wi-Fi-6 play in the field of industrial IoT?

5G technology has enough advantages to support so...

Imitate Spring to implement a class management container

Overview The original intention of the project wa...

How does user-mode Tcpdump capture kernel network packets?

[[422515]] This article is reprinted from the WeC...

Not enough data? Facebook will help you find free WiFi nearby

[[177139]] According to foreign media reports, Fa...

Ruijie Networks Completes SA-Based 5G Small Cell Test in China Mobile Laboratory

Ruijie Networks has always adhered to the concept...

ICO is suspended and blockchain needs to develop

ICO disguised as blockchain is like a glass of be...