Author: vamei Source: http://www.cnblogs.com/vamei welcome reprint, please also keep this statement. Thank you!
In Zhou xingchi's movie Tang bohu's qiuxiang, As soon as Zhou xingchi entered Washington, he was forced to add a code 9527. From then on, Washington started to call the main character 9527, rather than his name.
Domain name is the IP address code. A domain name generally consists of characters. For humans, domain names composed of characters, such as www.yahoo.com, are easier to remember than IP addresses composed of pure numbers (106.10.170.118. The domain name resolution System (DNS) is responsible for translating the domain name into the corresponding IP address. With the help of DNS, we can enter the domain name in the address bar of the browser, instead of the IP address. This greatly reduces the memory burden on Internet users. On the other hand, some websites may change their IP addresses due to maintenance and operation reasons. These websites can change the corresponding relationship in DNS to keep the domain name unchanged, while the IP address is updated. Because most users record domain names, this can reduce the impact of IP address changes.
From the machine and technology perspective, domain names are not necessary. However, the Internet is composed of machines and users. Given the great help of DNS for users, DNS has been considered an indispensable part of the TCP/IP package.
DNS Server
The ing between domain names and IP addresses is stored in the DNS server. The so-called DNS server refers to some servers (computers) that perform domain name resolution in the network ). These servers all have their own IP addresses and use the DNS protocol for communication. The DNS protocol is mainly based on UDP and is the application layer protocol (this is the first application layer protocol we have seen ).
A DNS serverHierarchical)Tree system. Each node is a DNS server, and each node has its own IP address. The top of the tree is the DNS server at the user's computer exit. In Linux, you can useCAT/etc/resolv. confIn Windows, you can useIpconfig/all, come
Query the egress DNS server. The end of the tree is a real domain name/IP correspondence record. A dns query starts from the top node of the tree and finds the corresponding end records.
Based on the domain name composition, the intermediate node directs the DNS query to the server at the next level. For example, if a domain name is cs.berkeley.edu, DNS resolution splits the domain name into CS, Berkeley, and edu, and then queries (EDU, Berkeley, and CS) in reverse order ). The egress DNS first directs the query to the EDU node of the next layer based on Edu. The EDU node then points the query to the Berkeley node of the next layer based on the Berkeley. This Berkeley server stores the IP address of cs.berkeley.edu. Therefore, the intermediate node keeps redirecting and directs us to the correct record.
During the entire DNS query process, both the user computer and the DNS server use the DNS protocol to communicate with each other. Based on the feedback from the DNS server, the user's computer establishes communication with the DNS server on the next layer in sequence. After recursive query, the user computer finally communicates with the end node and obtains the IP address.
From Wikipedia
Cache
The domain name resolution module (DNS resolver) in the user's computer's operating system is responsible for domain name resolution. Any applicationProgram(Email, browser) You can call this module for domain name resolution.
Not every time a domain name is resolved, it requires a complete process of resolution. DNS resolver usually hasDNS Cache(Cache), used to record the domain name/IP relationship between recent use and query. Before performing a DNS query, the computer first queries whether there are related records in the cache. In this way, repeated domain names do not need to go through the entire recursive query process.
From Wikipedia
Reverse DNS
The above DNS queries are all forward DNS queries: You already know the domain name and want to query the corresponding IP address. Reverse DNS (reverse DNS) is a domain name that you want to query when you know the IP address. Reverse DNS also uses hierarchical query. For an IP address (such as 106.10.170.118 ),In-addr.arpaNode (for IPv6Ip6.arpa Node), 106 nodes, 10 nodes, and 170 nodes, and obtain the domain name corresponding to 106.10.170.118 on the node.
Instance
The video below comes from YouTube. I think it vividly explains how DNS works.
If not, visit: http://v.youku.com/v_show/id_XNTAwNDY2NjYw.html
Great video. Enjoy it quietly.
Welcome to the "protocol Forest" Series