Basic working principle of DNS, and forward and backward parsing and master-slave synchronization

Source: Internet
Author: User
Tags domain name server domain server

DNS ( Domain Name System , the domain Name System), the Internet as the domain name and IP address mapping of a distributed database, to make it easier for users to access the Internet, rather than to remember that can be directly read by the machine IP number of strings. the process of obtaining the IP address of the host name through the hostname is called domain name resolution .

DNS type of server:

Primary DNS Server: maintains the resolved library server in the domain responsible for parsing, and the analytic library is maintained by the management;

from a DNS server: "Replicating" from a primary DNS server or other from a DNS server (zone transfer) a copy of the analytic Library;

serial number: Resolves the version number of the library; the contents of the main server parsing library are changed and the sequence is incremented;

Refresh interval: The time interval from the server requesting the synchronization of the resolved library from the primary server;

retry interval: The time interval that is retried when the server requests synchronization from the primary server to resolve a library failure;

Expiry time: When the primary server is always not contacted from the server, how long after the abandonment from the server perspective, stop providing services;

Zone transfer:

Full-volume transfer: Transfer the entire analytic library

Incremental Transfer: Pass the part of the resolution library change

Cache DNS Server

DNS the working principle and process :

1 , the client presents a domain name resolution request and sends the request to the local domain name server.

2 , when the local domain name server receives the request, first queries the local cache, if has the record entry, then the local domain name server directly returns the result of the query.

3 , if the local cache does not have the record, the local domain name server sends the request directly to the root name server, and then the root name server returns to the local domain name server a queried domain ( subdomain of root ) the address of the primary domain server.

4 , the local server then returns the domain name server to send the request, and then accepts the requested server to query its own cache, and if there is no record, returns the address of the associated subordinate domain name server.

5 , repeat the fourth step until you find the correct record.

6. The local domain name server saves the returned results to the cache for the next use, and returns the results to the client.

Forward parsing:

(1) define the Zone/etc/named.rfc1912.zones in the master configuration file

Zone "Zone_name" in {

                                                  type{master ( main from ) |hint ( root ) |forward ( Span style= "font-family: ' The song Body '; > forward

File "Zone_name.zone";

};

Example: Vim/etc/named.rfc1912.zones

Zone "magedu.com" in {type Master; File "Magedu.com.zone";};


Check for syntax errors: #named-checkconf

(2) Defining a Zone resolution library

in the /var/named created under directory Magedu.com.zone file

# vim magedu.com.zone$ttl 86400@     in    soa   ns1.magedu.com.   (                   20150425                   1H2                   5M                   7D                   1D )       IN     NS   ns1.magedu.com.      IN    ns    ns2.magedu.com.ns1   in    a     172.16.249.17ns2   in   a     172.16.249.12ww w  in     a    172.16.249.17


Check for syntax errors: #named-checkzone "magedu.com"/var/named/magedu.com.zone

Test command: Dig

Dig [-T type] name [@SERVER] [query options]

parsing www.magedu.com

[Email protected] named]# dig-t A www.magedu.com @172.16.249.17

; <<>> dig 9.8.2rc1-redhat-9.8.2-0.30.rc1.el6<<>> -t a  www.magedu.com @172.16.249.17;;  global options: +cmd;;  Got answer:;;  ->>HEADER<<- opcode: QUERY, status: NOERROR, id:50599;;  flags: qr aa rd ra; query: 1, answer: 1, authority: 2, additional: 2 ;;  QUESTION SECTION:;www.magedu.com.                          IN      A ;;  ANSWER SECTION:www.magedu.com.                  86400       IN      A       172.16.249.17 ;;  authority section:magedu.com.                   86400       in     ns     ns1.magedu.com.magedu.com.                   86400       in     ns     ns2.magedu.com. ;;  additional section:ns1.magedu.com.          86400        IN     A        172.16.249.17ns2.magedu.com.          86400        IN     A        172.16.249.12 ;;  Query time: 1 msec;;  server: 172.16.249.17#53 (172.16.249.17);  WHEN: Sat Apr 25 16:17:27 2015;;  msg size  rcvd: 116


Reverse parsing:

Region name: Network address back write . In-addr.arpa.

(1) define the area

Zone "Zone_name" in {

Type{master|slave|forward} ;

file " Network Address . Zone "

};

Cases:

Zone "1.16.172.in-addr.arpa" in {typemaster; File "192.168.zone";};


(2) Zone Resolution library file

Note: MX and A, as well as AAAA Records are not required; PTR record-oriented;

 $TTL  86400$origin 1.16.172.in-addr.arpa.@   in     soa  ns1.magedu.com.   admin.mage.com. (              2015042501               10M               5M               3D               1D )     IN    NS   ns1.magedu.com.     IN    NS   ns2.magedu.com.11  IN    PTR   ns1.magedu.com.12  IN   PTR    Ns2.magedu.com. 


parsing 172.16.249.17

[[Email protected] ~]# dig -x 172.16.249.17 ; <<>> dig  9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6<<>> -x 172.16.249.17;;  global options: +cmd;;  Got answer:;;  ->>HEADER<<- opcode: QUERY, status: NOERROR, id:24949;;  flags: qr aa rd ra; query: 1, answer: 1, authority: 2, additional: 2 ;;  QUESTION SECTION:;17.249.16.172.in-addr.arpa.          in     ptr ;;  ANSWER SECTION:17.249.16.172.in-addr.arpa. 86400 INPTR  ns1.magedu.com. ;;  AUTHORITY SECTION:249.16.172.in-addr.arpa. 86400   IN      NS    ns2.magedu.com.249.16.172.in-addr.arpa. 86400   IN      ns    ns1.magedu.com. ;;  additional section:ns1.magedu.com.          86400        IN     A        172.16.249.17ns2.magedu.com.          86400        IN     A        172.16.249.12 ;;  Query time: 1 msec;;  server: 172.16.249.17#53 (172.16.249.17);  WHEN: Sat Apr 25 16:11:33 2015;;  msg size  rcvd: 136



Basic working principle of DNS, and forward and backward parsing and master-slave synchronization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.