DNS service setup

DNS is short for Domain Name System, which consists of resolvers and domain name servers.

A domain name server refers to a server that stores the domain names and corresponding IP addresses of all hosts in the network and has the function of converting domain names to IP addresses.

The domain name must correspond to an IP address, and the IP address does not necessarily have a domain name

DNS is a server for domain name resolution

 

 

yum install bind* -y

Server configuration file path /var/named/redhat.com.zone

Client configuration file path /etc/resolv.conf

Need to use named.service

 

 

 

 

 

 

Forward DNS configuration

vim /etc/named.conf

options {

        listen-on port 53 { 10.100.52.169; };

        directory       "/var/named";

        dump-file       "/var/named/data/cache_dump.db";

        statistics-file "/var/named/data/named_stats.txt";

        memstatistics-file "/var/named/data/named_mem_stats.txt";

        allow-query     { any; };

        allow-query-cache { any; };

        recursion yes;

        forwarders {114.114.114.114;};

};

 

logging {

        channel default_debug {

                file "data/named.run";

                severity dynamic;

        };

};

 

zone "." IN {

        type hint;

        file "named.ca";

};

 

zone "example.com" {

        type master;

        file "example.com.zone";

};

/var/named/redhat.com.zone

 

Regional configuration

/var/named

 

$TTL 1D

@ IN SOA redhat1.example.com. [email protected].

                                        201206  ; serial

                                        1D      ; refresh

                                        1H      ; retry

                                        1W      ; expire

                                        3H )    ; minimum

@ IN NS redhat1.example.com.

redhat1    IN   A       10.100.52.169

redhat2    IN   A       10.100.52.169

~                                       

bbs       IN    A    www                     CNAME

          Add CNAME to visit bbs.redhat.com

 

 

 

windows test DNS

First modify the local DNS

Enter the IP address of the server in the preferred DNS server in the IPV4 properties of the network connection

Install httpd server

Write the content in /var/www/html/index.html of the server and client respectively

Restart the server and client services separately

Log in to the website built by yourself through the browser

 

 

linux command line test

vim /etc/resolv.conf Modify DNS

nameserver 172.16.40.127

 

command line input

you www.redhat.com

Can see DNS IP

 

 

Forward batch parsing 

Add function to configuration file  

$GENERATE       1-200 station$        IN A 172.16.40.$

The host name can be resolved by adding a number from 1 to 200

Test First change the hostname

you station50.redhat.com

 

 

Change the hostname to station100.redhat.com

Entering station100.redhat.com in the browser can also resolve to

 

 

 

reverse parsing

/etc/named.conf (see if it is added)

options {

        listen-on port 53 { 172.16.40.2; };

        directory       "/var/named";

        dump-file       "/var/named/data/cache_dump.db";

        statistics-file "/var/named/data/named_stats.txt";

        memstatistics-file "/var/named/data/named_mem_stats.txt";

        allow-query     { any; };

        allow-query-cache { any; };

        recursion yes;

};

 

zone "." {

         type hint;

         file "named.ca";

};

 

zone "example.com" {

         type  master;

         file  "example.com.zone";

};

zone "40.16.172.in-addr.arpa"{

         type   master;

         file   "40.16.172.in-addr.arpa.zone";

         file "172.16.40.arpa"; (test whether to add)

};

 

vim /var/named/40.16.172.in-addr.arpa.zone

Add to

$TTL 1D

@ IN SOA dns.redhat.com. [email protected].

                                        201206  ; 

                                        5m      ; 

                                        15m     ; 

                                        1W      ; 

                                        3h ); 

@ IN NS dns.redhat.com.

127           IN PTR     www.redhat.com.

127           IN PTR     www.redhat.com.

128           IN PTR     server.example.com.

Reverse parsing can only be tested with the command line

Add nameserver server IP in client /etc/resolv.conf

Forward nslookup www.redhat.com

reverse dig -x IP

dig is forward parsing

Reverse batch parsing adds $GENERATE $1-200 IN PTR station$.redhat.com.  

reverse batch parsing dig -x 172.16.40.200    

 

 

Secondary DNS mentions fault tolerance to speed up queries

Need to open another virtual machine to assist

yum install bind

vim /etc/named.conf

options {

        listen-on port 53 { 172.16.40.129; };

        directory       "/var/named";

        dump-file       "/var/named/data/cache_dump.db";

        statistics-file "/var/named/data/named_stats.txt";

        memstatistics-file "/var/named/data/named_mem_stats.txt";

        allow-query     { any; };

        allow-query-cache { any; };

        recursion yes;

};

 

zone "." {

         type hint;

         file "named.ca";

};

 

zone "redhat.com"  {

   type slave;

   file "slaves/redhat.com.zone";

   masters{172.16.40.127;};

};

zone "40.16.172.in-addr.arpa"{

   type slave;

   file "slaves/40.16.172.in-addr.arpa.zone";

   masters {172.16.40.127;};

};

vim /var/named/slaves/redhat.com.zone

save and exit

vim /var/named/slaves/40.16.172.in-addr.arpa.zone

save and exit

cd / var / named

Modify slaves permissions 766 to use recursion

cd / var / named / slaver

Check if there are new files in this directory

Guess you like

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