Detailed explanation of DNS master-slave configuration under Linux system

1. Overview of
DNS DNS (Domain Name System), the domain name system. As a distributed database that maps domain names and IP addresses to each other on the Internet, it enables users to access the Internet more conveniently without having to remember IP strings that can be directly read by machines. The process of obtaining the IP address corresponding to the host name through the host name is called domain name resolution (or host name resolution). The DNS protocol runs on top of the UDP protocol and uses port number 53. The role of the DNS server is to find the IP address of the corresponding target host or the corresponding host domain name for various network programs, just like the phone book and the 114 number search station in life.

2. DNS function
Each IP address can have a host name. The host name consists of one or more strings, and the strings are separated by decimal points. With a hostname, instead of memorizing the IP address of each IP device, just remember a relatively intuitive and meaningful hostname. This is what the DNS protocol is supposed to accomplish.

There are two ways to map hostnames to IP addresses:
1) Static mapping, each device is configured with host-to-IP address mapping, each device maintains its own mapping table independently, and is only used by the device;
2) Dynamic mapping , establish a set of domain name resolution system (DNS), and only configure the mapping from host to IP address on a dedicated DNS server. For devices on the network that need to use host names to communicate, you first need to query the DNS server for the IP address corresponding to the host.

The process of obtaining the IP address corresponding to the host name through the host name is called domain name resolution (or host name resolution). When resolving a domain name, the static domain name resolution method can be used first, and if the static domain name resolution is unsuccessful, the dynamic domain name resolution method can be used. You can put some commonly used domain names into the static domain name resolution table, which can greatly improve the efficiency of domain name resolution.

Forward resolution: Find the corresponding IP address according to the host name (domain name) (the most practical application)
Reverse resolution: Find the corresponding host domain name according to the IP address (not commonly used, generally used when building a mail server.)

According to the relationship between the server and the provided domain name resolution records, the DNS server is divided into different roles:
1) The caching domain name server, also known as the only cache server,
obtains the domain name -> IP address record by querying other domain name servers
. Cached locally to improve the speed of repeated queries

2)
The official server of the specific DNS area of ​​the main domain name server, which is unique and
responsible for maintaining the mapping records of all domain names -> IP addresses in the area

3) The domain name->IP address record maintained from the domain name server (which is commonly used to back up the DNS server)
is also called the auxiliary domain name server . The software used to build the DNS service application from the main domain name server is: BIND (Berkeley Internet Name Daemon) )

DNS adopts CS architecture, and the server works on port 53 of UDP protocol and port 53 of TCP protocol. FQDN (Fully Qualified Domain Name) is a fully qualified domain name, which is a full path domain name using the DNS tree-like hierarchical structure to represent a host corresponding to an exact location. DNS provides forward resolution (FQDN-->IP) and reverse resolution (IP-->FQDN).

There are 13 sets of DNS root servers in the world, 11 in the United States, one in Norway, and one in Japan. The DNS service is heavily guarded. How important its security is, once it is attacked, the global Internet will be interrupted, one can imagine.

View the services of 13 root nodes around the world:

# dig -t NS .

DNS forward and reverse
DNS (Domain Name Service) domain name service is the domain name resolution server. The so-called name resolution process is that an application queries a specified database based on a search key, and then queries some corresponding keys. The process of exporting the corresponding key. 
NDS is an infrastructure service of the Internet. It is a protocol. The protocol is finally implemented, and there are many software for protocol implementation. BIND can be used to implement DNS. It listens on port 53 of UDP when it runs, and listens to port 53 of TCP at the same time, and port 53 of both protocols is monitored.

Domain name: such as http://www.wangshibo.com/ --> IP address

First-level domains are divided into three types
of organizational domains : .com, .org, .mil, .gov, .edu, .net, and
country domains : .cn, .hk, .tw, .us, .jp, .ir, . uk
reverse domain : .in-addr.arpa

3. Internet DNS access model

The DNS server uses a distributed data structure to store a large number of names, so how can users quickly access which server or which servers on the Internet can find the data to be resolved?

The client initiates a parsing request to www.kernel.org
1) The client first checks and finds the local hosts file, if there is, it returns, otherwise it goes to the next step
2) The client checks the local cache to see if there is a cache for this entry, and if so, directly Return, no more requests are sent out, otherwise go to the next step, forwarding.
3) Forward the request to the local DNS server.
4) Check whether the domain name is resolved locally, if yes, the local resolution is returned, otherwise, go to the next step.
5) The local DNS server first looks up in the cache, returns if there is, and proceeds to the next step if not.
6) Initiate a DNS request to a root domain server in the world, and the root domain returns the address list of the org domain.
7) Use the IP address of an org domain to initiate a DNS request, and the org domain returns the address list of the kernel domain server.
8) Use a certain kernel domain IP address to initiate a DNS request, the kernel domain returns the IP address of the www.kernel.org host, and the local DNS service returns it to the client after receiving it.
The direct query method between the client and the local DNS server above is called recursive query.
The way that the local DNS server repeats the query multiple times is called iterative query.

1.1 Classification of DNS:
Primary DNS server: It is a DNS server that stores original data.
Slave DNS Server: A DNS server that synchronizes data from the primary DNS server using the automatic update method. Also becomes a secondary DNS server.
Cache server: It is not responsible for local resolution, and forwards client query requests in a recursive manner, and returns the result to the client's DNS server. At the same time, the results returned by the query are cached, which is also called a recursive server.
Forwarder: When this DNS finds a query request that is not the responsibility of the local machine, it no longer initiates a request to the root domain, but directly forwards it to one or more designated servers. It does not cache query results by itself.

1.2 RR (Resource Record) Resource Record
In the DNS hierarchy, both nodes and leaf nodes are resources. The identifier of one of these resources is represented by a multi-field record in a certain format. This record is the resource record. RR. The standard for RR is documented in RFC 1034.

1.3 Composition of RR

1.4 Common types of IN class (class) in RR

1.5 Common Commands
1) $TTL
TTL This command can be used before SOA to give a 32-bit integer value of TTL seconds.
2) $ORIGIN
sets the domain name, which must appear before any RR record that is omitted from writing. When a zone file is first read, the implied value of this command is <zone_name>. (must be followed by a period). If it is not set, the FQDN must be written in the zone file.
For example,
$ORIGIN kernel.org.
www CNAME web-server
is equivalent to
www.kernel.org. CNAME web-server.kernel.org.
3) @ symbol
@ symbol is equivalent to $ORIGIN.

1.6 RDATA format of SOA

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326307681&siteId=291194637