Each computer in the Internet has a unique IP address that can be connected to the corresponding host by IP address. However, the IP address is a number of abstract numbers, inconvenient memory, it is best to use some meaningful combination of characters to represent a host, resulting in the domain Name System (dns,domain name systems). DNS addresses a number of meaningful combinations of characters to an abstract IP address, that is, the mapping between host names and IP addresses is saved through a DNS server.
Domain name
The address scheme in the network has two sets: IP address system and domain name address system. These two sets of address systems are one by one corresponding relationships. The IP address is represented by a binary number, each IP address is a 32-bit binary, consisting of 4 numbers less than 256, and the numbers are separated by dots, for example 220.181.28.53 represents an IP address. The character address that corresponds to the digital IP address in the network is called the domain name.
A domain name usually consists of an English letter or an Arabic numeral and a horizontal line "-" up to 67 characters (including suffixes), and the case of the letter is no different, each level can not exceed 22 letters. These symbols form the prefix, subject, and suffix of the domain name, and are grouped together to form a complete domain name.
Domain names must be applied in accordance with the rules of the administrative authority. If a domain name has already been requested for use, the same name cannot be used, and if the domain name is used in the intranet (LAN without Internet access), the domain name can be set by the user (System administrator).
Example www.163.com to illustrate: It consists of two parts, 163 is the main body of the domain name, com is the suffix of the domain name, representing this is a COM international domain name. WWW is the hostname, 163.com is the domain name of www.
Domain Name space
Domain name space refers to a complete structure of the domain name. The DNS domain name space is organized into a tree structure, and each domain name corresponds to a node in the tree. Each domain represents a specific piece of the namespace and is managed by an administrative entity. The root of the domain tree is called ".", and below the root is the top-level domain. There are two types of top-level domains: The first is the ordinary top-level domain, which represents organizational or administrative institutions, such as COM (business, commercial, and financial) and EDU (educational institutions). The second is the country (or region) code top-level domain, which is the country (or region) code that appears because of the rapid development of the Internet, such as CN (China) and US (US). In the top-level domain, users can apply for easy-to-remember domain names that embody certain meanings.
The hierarchical structure of DNS is as follows:
DNS server type
The domain name server can be divided into 3 types, the primary DNS server, the secondary DNS server, and the cache server.
1 Primary DNS Server
The DNS server holds authoritative information sources for all information in the domain and reads the domain information from an administrator-edited, readable, writable zone profile. That is, the DNS server can either accept the registration of a new user or provide a name resolution service to the user.
2 Secondary DNS servers
The DNS server provides DNS queries to users in the domain, primarily to mitigate the load on the primary DNS server. Unlike the primary DNS server, the DNS server does not maintain a local zone profile, copies the zone configuration files from the primary DNS server to the local file system, and the zone record information is read-only. That is, the DNS server cannot accept the registration of new users and can only provide name resolution services for registered users.
3 Cache Server
The cache server only runs the DNS server program, and the zone configuration file does not exist locally. When a DNS client queries a domain name, the cache server simply turns to a lookup operation, saves the results returned by the DNS server in the cache, and the cache server can immediately return the parse result when a user queries the domain name later. The cache server's parsing results are not authoritative and provide only indirect information.
The process of DNS parsing
DNS is based on client/server mode, when a DNS client uses a domain name, sends a service request to the DNS server, the server resolves the request, and returns the parse result to the client. This completes the domain name resolution once. Because there are a large number of hosts in the Internet and are constantly increasing, the "tree" that forms the DNS domain name is stored as a distributed database in different DNS servers around the world.
Illustrate the parsing process: Suppose there is a LAN environment where a DNS server is installed on the local area network that points to the root domain server, and the DNS for each client in the LAN points to this DNS server in the intranet. Now there is a client in the LAN that needs to access the host domain name wyh.com, the parsing process is as follows:
1 Local workstations from the local settings, the IP address of the local DNS server is a workstation in the intranet, so the domain name that needs to be resolved is sent to that host.
2 The local DNS server is first located in the local cache and the local repository, and if the corresponding domain name information is not found, the lookup information is sent to the root domain server.
3 The root domain server does not know the IP of the specific domain name, and the IP address of the DNS server that manages COM is returned if the top-level domain in the domain name that is sent is COM.
4 The local DNS server sends the query information to the COM Management Server after it receives the IP address of the DNS server that manages COM.
5 COM servers typically do not save resolution information for a specific domain name, and return the IP address of the DNS server that manages the domain name according to the domain name.
6 The local DNS server sends a resolution request to the Wyh.com Management Server again.
7 manages the wyh.com domain name resolution information for the server to send back the resolved information.
8 The local DNS server stores the parsed information received in the cache and returns the parsing information to the local workstation where the request was made.
9 Local workstations use the obtained IP address to access the wyh.com host.
The above process simulates the process of querying through 4 DNS servers. In real-world applications, it may be necessary to forward more DNS servers to obtain the parsing information. In the example above, the best case is that when you access a local DNS server, you can get the parsing information directly from the cache.
Resources
"Linux Server Configuration and management" p219-223
Java Web DNS