天天看點

DNS伺服器安裝與配置(Linux)

1、yum install -y bind bind-utils bind-chroot bind-libs;

2、其中:/etc/named.conf 為主配置檔案;/var/named 為解析檔案

3、用戶端的dns查詢時的配置檔案

/etc/hosts 預設優先查詢這個

/etc/resolv.conf DNS寫在這裡面

/etc/nsswitch.conf 查詢優先級的設在這裡

4、vi /etc/named.conf

options {

listen-on port 53 { any; };

listen-on-v6 port 53 { ::1; };

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; };

/*
     - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
     - If you are building a RECURSIVE (caching) DNS server, you need to enable
       recursion.
     - If your recursive DNS server has a public IP address, you MUST enable access
       control to limit queries to your legitimate users. Failing to do so will
       cause your server to become part of large scale DNS amplification
       attacks. Implementing BCP38 within your network would greatly
       reduce such attack surface
    */
    recursion yes;

    dnssec-enable yes;
    dnssec-validation yes;

    /* Path to ISC DLV key */
    bindkeys-file "/etc/named.iscdlv.key";

    managed-keys-directory "/var/named/dynamic";

    pid-file "/run/named/named.pid";
    session-keyfile "/run/named/session.key";
           

};

zone "." IN {

type hint;

file "named.ca";

zone "weixin.qq.com" IN {

type master;

file "named.weixin.qq.com";

zone "49.61.183.in-addr.arpa" IN{

file "named.183.61.49";

zone "140.215.14.in-addr.arpa" IN{

file "named.14.215.140";

zone "alipay.com" IN {

file "named.alipay.com";

zone "75.110.in-addr.arpa" IN{

file "named.110.75";

include "/etc/named.rfc1912.zones";

include "/etc/named.root.key";

5、vi /var/named/named.aplipay.com

$TTL 600

@ IN SOA

dns.xmrbi.com

.

. (2018011901 3H 15M 1W 1D )

@ IN NS

. ; DNS 伺服器名稱

dns.xmrbi.com. IN A 172.16.50.30 ; DNS 伺服器 IP

openapi.alipay.com. IN A 110.75.244.202

mapi.alipay.com. IN A 110.75.231.40

6、vi /var/namd/named.110.75

244.202 IN PTR openapi.alipay.com.

231.40 IN PTR mapi.alipay.com.

繼續閱讀