DNS concept and configuration details

xiaoxiao2021-03-06  97

DNS concept and configuration details

DNS origin

At the end of the 60th year, the United States funded the testive wide-area computer style, called Arpanet, 1970s, 190s, Arpanet is just a small network with hundreds of hosts, only a hosts file can accommodate the required host information, HOSTS Provided is a mapping relationship of the host name and IP address, that is, the host name can be shared by the host name, without having to remember the IP address. However, with the spread of the network, the HOSTS file is no longer able to complete the parsing task quickly, and the DNS appears. In fact, DNS is a distributed database that allows local control over each portion of the entire database (local control is also the so-called authorization, you can authorize the database, reducing the pressure of the main DNS server, is based on domain structure Licensed authorization).

DNS database

The DNS database is very similar to UNIX file system structure. The Directory name of the UNIX file system (such as / usr / local / bin) is equivalent to the domain name in the DNS (.com.myHome.www). DNS is divided into points (.), And UNIX is used to cut the directory. Domain Name identifies where it is in the database, the example MyHome is the subdomain under the COM domain, and local is the subdirectory of USR.

Basic concept of DNS

Domain

Domain is a subtree in the domain name space. It is a tree tree, which is the branch of the tree. The name of the domain is the domain name of the top node of the subtree.

Name Server

The program called the information about the domain space is called the name server. The name server typically contains a complete information of a part in the domain name space, which we call zone (ZONE). The content of the area is loaded from the file or other name server. At this time, we call the name server (Name Server) has an authority (Authority). A name server can also have authority to multiple districts at the same time.

All top domain names, as well as many secondary domain names and lower-level domain names, by authorization being divided into cells that are also better managed, which are called zone (zone).

District data file

The primary name server is filed from the file area data file (Zone Data file) that loads the data in this unit, often known as a data file or database file. The keccular server is often configured to: back up the area data transferred from the primary name server to the local data file.

Recursion

If the name server being queried is not the authority of the requested data, it will have to issue a query to other named servers to get the answer. It can send recursive queries to other name servers, requiring them to find the answer and return.

repeatedly

Repeated name servers only returns the most appropriate answer it knows to the query. It doesn't have any other queries itself. The name server being queried is looking for the required data in its local data. If the answer is not found, it finds the name and address of the name server closest to the name server you want to query, and returns to the query as an indication to help it go on the resolution process.

In the current implementation of DNS, the latter is used, which will continue to be queried in accordance with the instructions until the result is found.

Cache

The name server that handles recursive queries may need to send several queries to find results. But in this process. It also understands many of the information on domain names. Every time it gets the indication of some name server list, it knows the authority of these name servers, and knows the address of these servers. When the parsing process ends, it finally finds the original query the data requested, you can save these data for backup. That is, when I find the same domain name, at this time, the name server has put the result in the cache, and only needs to return this result to the parser (IP address), no need to check. Survival

That is the name server allows data to be stored in the cache (TIME TO LIVE) TTL. In the survival period, the name server must discard the data in the cache and get new data from the authoritative name server. It is closely related to the cache.

About Host.conf file

The host.conf file is a priority profile for setting various name services.

ORDER BIND HOSTS, where bind represents DNS service, hosts represents / etc / hosts file, Multi ON Multi options are used to assign multiple addresses to the same hostname in / etc / hosts file. ON indicates that this option is opened.

District data file

Most of the district data files are called DNS resource records. DNS lookup is not case sensitive. The order of resource records in the data file is as follows:

SOA Record: Guide to the area

SOA serial number: Each district data file has a serial number. Each time you modify the data in the district data file, you must increase its serial number. If you do not add a serial number, the secondary server of the area will not get the modified data.

Refresh field: Define the time of the refresh cycle. Each refresh cycle is detected from the server on the SOA type record of the primary server to determine if the area needs to be transmitted. The refresh cycle can be the week (W), day, hour, minute, second.

Retry field: This number defines the length of time of the retry cycle. The retry cycle tells the slave server: When the primary server corresponds to a SOA type record, it should wait for more time.

Expire field: This number is a deadline, that is, from the server should continue to respond to the time length of the query even when it cannot update the zone file.

NS record: a name server in the area

A - Map of the name to the address

PTR - the image to the name of the name

CNAME - Specification Name

Note: The end of the line is ended with a semicolon (;).

Set the default TTL value of the area: The name server provides this TTL value in the query response, allowing other servers to store the data specified by the data in the cache.

Possible values ​​are:

W = week

D = day

H = hour

m = minute

s = second

Example: $ TTL 3H 3 hours

$ TTL 2W3D4H 2 weeks 3 days 4 hours

Main DNS server with from DNS server

Example:

Named.conf file of the main DNS:

Options {Directory "/ var / name";}; zone "." IN {type hint; file "named.ca";}; zone "localhost" in {TYPE MASTER; file "localhost.zone"; allow-update { None;};}; zone "0.0.127.in-addr.arpa" in {type master; file "named.local"; allow-update {none;};}; zone "myhome.com" in {Type Master File "myhome.coms"; allow-update {none;};}; zone "1.168.192.in-addr.Arpa" in {type master; file "named.reverse"; allow-update {none;}; }; Master server corresponding to the parallel parser: myhome.coms

@ SOA JH.MYHOME.COM. Root.jh.myHome.com. (200002050; 604800; 900) ns jh.myHome.com. MX 10 jh.myHome.com. JH in A 192.168.1.1 Yj11 in A 192.168.1.2 Three in cname jh.myHhome.com. WWW in A 192.168.1.12

Reverse resolution file corresponding to the primary server: named.reserves

ot.jh.myHome.com. Root.jh.myHome.com. (2000021602; 21600; 1800; 604800; 7200); ns jh.myhome.com.

1 ptr jh.myhome.com.

2 ptr yj11.myhome.com.

From DNS's named.conf file:

Options {Directory "/ var / name";}; zone "." IN {type hint; file "named.ca";}; zone "localhost" in {TYPE MASTER; file "localhost.zone"; allow-update { None;};}; zone "0.0.127.in-addr.Arpa" in {type master; file "named.local"; allow-update {none;};}; zone "myhome.com" in {// TYPE MASTER; TYPE SLAVE; // Type The value has become slave; file "myhome.coms"; // File can also be other file names without the same MASTERS {192.168.1.1;}; //192.168.1.1 is the IP address of the main DNS server,}; zone "1.168.192.in-addr.arpa" in {// type master; type slave; // Type) The value has become Slave; File "named .reverse "; // File can also be the other file name without having to match the main DNS server settings MASTERS {192.168.1.1;}; //192.168.1.1 is the IP address of the main DNS server,}; no use from DNS Build myHome.Coms and named.reserse files on the server, because the new start from the process from the DNS server (that is, the first restart) is automatically re-started (192.168) .1.1) Copy the data file (myHome.COMS) content to the DNS server. Automatic innovation these two main files.

The ReferSh field defines the refresh cycle time. From the server, copy the data file from the primary server from the primary server to the slave server. If you want to modify the data file on the primary server, you must change the 2000020501; serial number, increase 1 is 2000020502, such a slave server is 3h after 3 hours You will check the serial number if you are high than your own serial number, if you automatically copy the file to the slave server, if you don't add "serial number", even if you don't add the contents of the main server, you will not copy the contents of the main server to the server.

转载请注明原文地址:https://www.9cbs.com/read-123167.html

New Post(0)