Linux DNS server set up

This tutorial involves two services

The first part is a pseudo-DNS cache service building

The second part is the Domain Name Service building

First part: DNS server cache dummy structures

1.1, the installation package pseudo DNS resolution cache

[root@dns-server ~]# yum -y install bind bind-chroot

 

1.2, to enable unauthorized file caching DNS service

[ The root DNS-Server @ ~ ] # Vim / etc / the named.conf 
Options {    - forwarding service areas 
        the listen - ON Port 53 is { 127.0 . 0.1 ;};    
        the listen - ON - V6 Port 53 is {:: . 1 ;}; 
        the allow - Query {localhost;}; 
        forwarders along { 202.102 . 134.68 ; 114.114 . 114.114 }; 
}; 
----------------- DESCRIPTION ------------------------- 
the listen - ON Port 53 is { 127.0 . 0.1 ;}; // this can be deleted, or spend to fill any brackets, or other clients can not access 
the listen - ON - V6 Port 53 {:: 1 ;};     // this can be deleted, or fill any braces otherwise, other clients can not access 
the allow - Query {localhost;};    // this can be deleted, or fill any braces, or other clients can not access 
can add a {forwarders along 202.102 . 134.68 ; 114.114 . 114.114 } ; it is forwarded to a DNS server
 [dns-Server ~ @ root ] # vim / etc / named.conf 
. "" Zone the IN {            - root prompt area, tips on how to find the root servers to achieve resolve 
        of the type hint;
         File "named.ca"; - Global 13 address of the root server station comprising IPV4 / V6, this database provides parsed 
};
 - ---------------- described ------------- ------------ 
representative of the root domain. ""
 [ the root DNS-server @ ~ ] # Vim / var / the named / the named.ca     - global address table 13 contains the root server IPV4 / V6

 

 

1.3, a pseudo open through the firewall and caching services

[root@dns-server ~]# systemctl start named
[root@dns-server ~]# systemctl enable named
[root@dns-server ~]# firewall-cmd --permanent --add-service=dns
[root@dns-server ~]# firewall-cmd --reload

 

2, the client

DNS address of the client to change the IP pseudo-caching DNS server is

1.1, DNS client installation test tool

[root@server-1 ~]# yum -y install bind-utils

 

1.2, start the test

[root@server-1 ~]# dig www.baidu.com
​
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12262
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 5, ADDITIONAL: 6
​
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.baidu.com.                 IN      A
​
;; ANSWER SECTION:
www.baidu.com.          611     IN      CNAME   www.a.shifen.com.
www.a.shifen.com.       292     IN      A       61.135.169.125
www.a.shifen.com.       292     IN      A       61.135.169.121
​
;; AUTHORITY SECTION:
a.shifen.com.           611     IN      NS      ns4.a.shifen.com.
a.shifen.com.           611     IN      NS      ns3.a.shifen.com.
a.shifen.com.           611     IN      NS      ns5.a.shifen.com.
a.shifen.com.           611     IN      NS      ns1.a.shifen.com.
a.shifen.com.           611     IN      NS      ns2.a.shifen.com.
​
;; ADDITIONAL SECTION:
ns1.a.shifen.com.       611     IN      A       61.135.165.224
ns4.a.shifen.com.       611     IN      A       14.215.177.229
ns5.a.shifen.com.       611     IN      A       180.76.76.95
ns2.a.shifen.com.       611     IN      A       220.181.33.32
ns3.a.shifen.com.       611     IN      A       112.80.255.253
​
;; Query time: 0 msec
;; SERVER: 192.168.254.10#53(192.168.254.10)
;; WHEN: Thu Apr 09 16:20:40 CST 2020
;; MSG SIZE  rcvd: 271

 

Ping the configuration is completed

 

Part II: analytical positive configuration

Forward Analysis: provides analytical positive, will be the DNS IP

Reverse lookup: provide reverse lookup, domain name resolves to the IP

Open three WEB server

The IP: 192.168 . 254.10   DNS server (DNS server cache just pseudo) 
the IP: 192.168 . 254.12   the WEB server    => Web Content: " min .com" 
the IP: 192.168 . 254.13   the WEB server    => Web Content: "aircoinst.com"

 

1, continue to use the current DNS server

1.1, enter the DNS service's main configuration file

[ The root DNS-Server @ ~ ] # Vim / etc / the named.conf 
Options { 
        Directory " / var / the named"; 
}; 
- ----------- -------- Description ------ 
Directory   // storage location of the database files 
the new 
Zone " min .com" {     - Create domain min.com 
        type master;     - main type 
        file " min .com.zone"; 
};

 

1.2, create a file parsing

[ The root DNS-Server @ ~ ] # Vim / var / the named / min .com.zone 
input 
@        the IN       the SOA the root DNS ( 2020040900 IH 15M 1W 1D)   - resource record 
@        the IN       the NS DNS DNS      the IN       A        192.168 . 254.10 
WWW      the IN       A        192.168 . 254.12 
- ----------- -------------- Description 
@        -   domain
The SOA      -   licensed to (starting authorization record) 
the NS       -   the DNS server records 
A        -   the IP 
DNS      -   host 
WWW      -   SQDN name of 
the root     -   Problems mailbox 
IH       -   one hour synchronization 
15M      -   fifteen minutes retry 
1W       -   week expiration time 
1D       -   day cache 

@        the iN       SOA dns root ( 2,020,040,900 1H 15M 1W 1D) 
domain is licensed to host gathering problem-mail

 

1.2, WEB server-side configuration

Use IP: 192.168.254.12 the WEB server => Web Content: "min.com"

DNS editor WEB server for just configured DNS server IP

1.3, the test is successful domain name resolution

[ The root @ ~ Server-2 ] . # Of ping WWW min .com 
. The PING WWW min .com ( 192.168 . 254.12 ) 56 is ( 84 ) bytes of . Data
 64 bytes from Server - 2 ( 192.168 . 254.12 ): icmp_seq = . 1 TTL = 64 Time = 0.014 MS
 [ the root-Server @ 2 ~ ] # curl WWW. min .com
 min .com      - web content display

 

done~!

Guess you like

Origin www.cnblogs.com/MineLSG/p/12668453.html
Recommended