1. 程式人生 > 實用技巧 >DNS--安裝&&配置檔案

DNS--安裝&&配置檔案

1下載服務

yum -y install bind

2配置檔案

 主配置檔案  /etc/named.conf

 區配置檔案  /var/named/

 配置檔案模板  /usr/share/doc/bind-9.8.2/sample

3協議及埠

 TCP  53  主要用於主從同步,需要的是可靠的資料傳輸

 UDP  53  主要用於客戶端查詢域名

4配置檔案詳解(named.conf 註釋為 // 或 /*)

[root@localhost ~]# egrep -v "^$|^\/" /etc/named.conf 
options {                      #全域性選項配置
        listen
-on port 53 { 127.0.0.1; };   #監聽套接字 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
"; #記憶體狀態檔案 recursing-file "/var/named/data/named.recursing"; secroots-file "/var/named/data/named.secroots"; allow-query { localhost; };    #允許哪些客戶端進行查詢,可寫成any,172.16.0.0/16等形式 /* - 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;            #啟用dns安全策略 dnssec-validation yes;         #啟用dns的valid安全策略 /* Path to ISC DLV key */ bindkeys-file "/etc/named.root.key"; #金鑰檔案 managed-keys-directory "/var/named/dynamic";  #管理金鑰的目錄 pid-file "/run/named/named.pid"; session-keyfile "/run/named/session.key";    #會話金鑰檔案 }; logging {                      #和日誌等相關的 channel default_debug { file "data/named.run";     #日誌路徑 severity dynamic;        #動態 }; }; zone "." IN {                    #域設定 type hint;                 #域型別:根域 file "named.ca";             #域檔名稱 }; include "/etc/named.rfc1912.zones";       #包含的子配置檔案 include "/etc/named.root.key";          #包含的金鑰檔案