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

How does Netty solve the half-packet and sticky-packet problems?

Netty is a high-performance, asynchronous event-d...

Black screen problem on some live IPTV channels under BRAS equipment

The telecom IPTV platform of a certain city found ...

Virtono: €29.95/year KVM-1GB/30GB/2TB/10 data centers available

Virtono recently launched the SPRING SALE 2022 ev...

What is 6G? It may appear in 2030, crushing 5G without any pressure

5G has already been deployed, so what about 6G? W...

Life is not easy, where is the future for terminal manufacturers in the 5G era?

From the 1G analog communication era to the 4G mo...

What impact will the Internet of Things have on corporate business?

Nowadays, whether people like it or not, the Inte...

What is the Internet of Things, what is blockchain, and what is big data?

In the near future, the number of IoT devices wil...

The role of 5G in education: enabling distance learning and virtual labs

In an era of rapid technological change, 5G is mo...

Dell'Oro: 6 GHz - the next 5G frontier?

Today, 5G is being deployed at full speed in the ...