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

Innovation is the key to 5G's "three good"

Wen Ku, director of the Information and Communica...

What kind of sparks will be created when 5G meets the power grid?

In the past, electricity changed the way of produ...

Summary of wireless network wiring principles and methods!

Select the location of the wireless AP For wirele...

8 technologies that are changing IT services

No one can deny that service is a job performed b...

Senhua Yiteng launches CDN intelligent service management platform

Adhering to the service-first concept, Senhua Yit...

Ubuntu 18.04 changes the IP address

My memory is getting worse and worse, just record...

If these five gaps cannot be overcome, 5G 2B will be a pipe dream for operators

In the 5G race, Asian operators are among the wor...

Cloud computing, IoT and SDN pose the biggest challenges to enterprise networks

According to a new report released by Kentik, clo...