first, the Domain Name System introduction
1. Domain Name System
Domain Name System is a distributed database, it makes the local control of the entire distributed database segment, each section of the data through the customer, the server model in the entire network can be accessed, through the use of replication technology and caching technology to make the entire database reliable, but also has good performance.
The domain name server contains information about part of the database and can be accessed by clients called parsers.
The DNS database structure forms an inverted tree structure in which the root name is represented by an empty string "", but in the text "." To write. Each node of the tree represents a partition (domain) in the entire distributed database. Each domain can be further divided into sub partitions (domains), each with a label (label) indicating its relationship to the parent domain. Domain also has a domain name, Gives its place in the entire distributed database. In DNS, the name of the domain names is a sequence of labels from the domain to the root, to "." Separate the labels. The label can contain up to 63 characters. The full domain name of each node in the tree is a sequence of labels from that node to the path between the roots.
If the root domain appears in the domain name of the node, the name looks like the end of the point (actually ending with a point and an empty tag). These dotted-ended domain names are called absolute domain names (absoulte domain name). A domain name that does not end with a point is called a relative domain name.
A domain (Domains) is a Shang tree in a tree domain namespace that is the same as the domain name of the child tree root node. In other words, the name of the domain is the name of the top-level node in the domain. For example, the top of the zhuhai.gd.cn domain is the node named zhuhai.gd.cn.
In DNS, each domain is managed by a different organization. Each organization can divide its domain into a number of subdomains and delegate those subdomains to other organizations for management. A domain can include both hosts and other domains (its subdomains). The domain name is used as an index in the DNS database. Any domain name in a child domain is considered part of the domain.
In fact, the host is the domain, the domain name is only the index in the DNS database, "host" can be linked to the relevant host information of the domain name to index, the domain contains all its domain name in the domain of the host.
In the domain name tree, the domain of the leaf node usually represents the host, their domain names point to network addresses, hardware information, and message routing information. A node in a tree whose domain name can either name a host or point to the structure of descendants or subdomains of the domain, and the internal domain name in the domain name tree is not limited by uniqueness, They can represent both their corresponding domain and a particular host on the network. For example, sun.com is both a sun domain and a domain name for mail servers that forward letters between sun and the Internet.
Each host on the network has a domain name, the domain name gives information about the host, the information contains IP address, mail routing information, etc., the host can also have one or more domain names alias, alias is only some point to the official domain name of another
1.1 Domain name.
An easy way to determine whether a domain is a subdomain of another domain is to compare their domain names. The child domain name ends with its parent domain name.
One of the main purposes of designing a domain Name System is to decentralize management, this is done by proxy. An organization that manages domains divides the domain into subdomains, each of which can be represented by other organizations, which means that the agent organization is responsible for maintaining all data in that child domain. They are free to change the data, You can even divide the subdomains that they manage into more subdomains and redistribute them. The parent domain contains only pointers to these subdomains, and thus references queries to that point.
1.2 Domain Name server
A program that stores information about domain name space is called a domain name server (name server). Typically, a domain name server has complete information about some domain name space (called a zone zone). A domain name server can have multiple extents of authorization.
The relationship between a zone and a domain:
The zone contains all the domain names and data that are contained in the domain except for those that are assigned to it by the proxy. If the domain's child domain is not represented by an agent, the zone contains the data in that subdomain and in the child domains.
DNS defines two types of domain name servers: primary Master and secondary master.pm domain name server
From the files on the host on which it is running, the SM domain name server obtains data from other domain names servers that are authorized by the zone. The SM domain name server periodically queries the PM domain name server to ensure the latest version of the zone data.
In general, it is best to set up a PM domain name server and a number of SM domain name servers. This can share the load. And to ensure that all the hosts in the zone have a relatively close domain name server for easy access.
The re-need parser (Resolver) that runs on the host and requires domain space information in bind, the parser is just a set of library routines, and compiled into programs such as Telnet and FTP, they are not separate processes. The parser does the work of pooling queries, sending queries and waiting for answers, The query is sent back when the answer is not received.
1.4 Mapping of Address to domain name
The data in the domain name is indexed by name, and it is relatively easy to find an address for a given domain name. But to find a domain name that maps to a certain address, you have to search for every domain name in the tree. If so, the efficiency will be quite low, in order to solve this problem, Create an address-indexed domain name space. This part of the namespace is called the In-addr.arpa domain.
The nodes in the IN-ADDR.ARPA domain are doted-octet (the 32bitIP address is represented by "."). A four-8bit decimal-form method) representing an IP address. The IP address is represented in the opposite direction in the namespace because the name is read from the leaf to the root, for example, the IP address of the www.zhuhai.gd.cn is 184.108.40.206, The corresponding in-addr.arpa subdomain is 177.105.202.in-addr.arpa so that the first byte in the IP address appears at the top of the tree so that the administrator has the ability to move the IN-ADDR.ARPA domain agent along the network join, For example, 177.105.202.in-addr.arpa can be delegated to the administrator of the network 177.105.202.
1.5 Cache and Lifetime
The name server, when processing recursive queries, you may have to do multiple queries to get information, in the process, the name server can get a lot of information about the domain name space, the name server will be so that the information is cached to speed up later queries. In addition to speeding up queries, caching allows us to not query root name servers again , so that we do not have to rely too much on the root name server to greatly reduce the load on the root name server.
The Lifetime (TTL) is the length of time the data is cached by the allowed name server, and once the lifetime is up, the name server must discard the cached data and retrieve the new data from the authorized name server. This ensures that domain data is consistent across the network.
1.6 Bind:linux Name Service
Linux, like all other Unix, uses bind to implement the name service. The server-side software for bind is a daemon called named