成人AV在线无码|婷婷五月激情色,|伊人加勒比二三四区|国产一区激情都市|亚洲AV无码电影|日av韩av无码|天堂在线亚洲Av|无码一区二区影院|成人无码毛片AV|超碰在线看中文字幕

Linux下源代碼編譯bind9.6安裝和配置DNS服務(wù)器

Linux 下源代碼編譯bind9.6安裝和配置DNS 服務(wù)器Linux 下源代碼編譯bind9.6安裝和配置DNS 服務(wù)器#./configure --prefix=/usr/local/named

Linux 下源代碼編譯bind9.6安裝和配置DNS 服務(wù)器

Linux 下源代碼編譯bind9.6安裝和配置DNS 服務(wù)器

#./configure --prefix=/usr/local/named --enable-threads #--enable-threads開啟多線程處理能力 #make

#make install

#cd /var/named

這是bsd 的一個簡單配置文件:

options {

directory "/var/named";#我去哪找解析文件

pid-file "/var/run/named/pid";進程文件放這吧

dump-file "/var/dump/named_dump.db";

statistics-file "/var/stats/named.stats";

listen-on { 192.168.0.83; };監(jiān)聽

notify yes;

logging {

channelquery_log {

file "query.log";日志名

severity info; 級別和syslog 差不多的那種

print-time yes;

print-category yes;

};

category queries {#分類Once a customized channel has been defined,

option is used to categorize the channel and begin logging when named is restarted

query_log;

};

};

forwarders {

221.228.255.1;159.226.5.65;

};#我解析不了就給他

};

include "acl.conf";

view "test" {

match-clients {xxx; }; #在acl.conf 中定義

recursion no; a category

,

zone "." {

type hint;

file "named.root"; #dig >named.root或者這下:ftp://ftp.rs.internic.net/domain/

};全球的根域名服務(wù)器

zone "0.0.127.IN-ADDR.ARPA" {

type master;

file "localhost.rev"; #sh make-localhost

或:

$TTL 86400 @ IN SOA @ root.localhost (

1 ; serial

28800 ; refresh 告訴某個區(qū)的輔域名服務(wù)器相隔多久檢查該區(qū)的數(shù)據(jù)是否是最新的

7200 ; retry 如果輔域名服務(wù)器超過刷新時間后無法訪問主域名服務(wù)器那么就每隔一段重試時間就試著聯(lián)系一次,重試時間通常比刷新時間要短

604800 ; expire 如果期滿時間內(nèi)輔助域名服務(wù)器還是無法與主域名服務(wù)器聯(lián)系上那么就宣布這個區(qū)失效,停止關(guān)于該區(qū)的任何查詢應(yīng)答

86400 ; ttl否定緩存ttl 值

)

官方推薦:刷新:24小時重試 2小時期滿30天默認ttl 4天

IN NS localhost.

@ IN A 127.0.0.1

};

zone "fashionfree.cn"{

type master;

file "fashionfree.fwd";

};

#zone "0.168.192.in-addr.arpa" {

# type master;

# file "master/test75.rev";

#};

使用rndc-confgen>rndc.conf生成key 文件然后通過tail -n10 rndc.conf | head -n9 | sed -e s/# //g >>named.conf將key 文件寫入name.conf

,

key "rndc-key" {

algorithm hmac-md5;

secret "YMVkQroow6D4rYGffjOkQw==";

};

controls {

inet 127.0.0.1/* port 953

allow { 127.0.0.1/any; } keys { "rndc-key"; };

};這決定rndc 用戶要用什么加密密鑰來驗證身份才能給域名服務(wù)器發(fā)送控制消息

rndc 是 bind 軟件引進的遠程控制通道,代替unix 信號來控制 named 進程, 可以用來對配置進行重新載入

#named -c named.conf

notify — Controls whether named notifies the slave servers when a zone is updated. It accepts the following options:

yes — Notifies slave servers.

no — Does not notify slave servers.

explicit — Only notifies slave servers specified in an also-notify list within a zone statement.

allow-update — Specifies the hosts that are allowed to dynamically update information in their zone. The default is to deny all dynamic update requests.

acl.conf:

acl "CNC" {

58.16.0.0/16;

xx.xx.xx.xx/xx;

}

allow-recursion

設(shè)定哪臺主機可以進行遞歸查詢。如果沒有設(shè)定,缺省是允許所有主機進行遞歸查詢。注意禁止一臺主機的遞歸查詢,并不能阻止這臺主機查詢已經(jīng)存在于服務(wù)器緩存中的數(shù)據(jù)。 recursion

如果是yes ,并且一個DNS 詢問要求遞歸,那么服務(wù)器將會做所有能夠回答查詢請求的工作。如果recursion 是off 的,并且服務(wù)器不知道答案,它將會返回一個推薦(referral )響應(yīng)。默認值是yes 。注意把recursion 設(shè)為no ,不會阻止用戶從服務(wù)器的緩存中得到數(shù)據(jù),它僅僅

,

阻止新數(shù)據(jù)作為查詢的結(jié)果被緩存。服務(wù)器的內(nèi)部操作還是可以影響本地的緩存內(nèi)容,如NOTIFY 地址查詢。

1. 遞歸查詢:

一般客戶機和服務(wù)器之間屬遞歸查詢,即當客戶機向DNS 服務(wù)器發(fā)出請求后, 若DNS 服務(wù)器本身不能解析, 則會向另外的DNS 服務(wù)器發(fā)出查詢請求,得到結(jié)果后轉(zhuǎn)交給客戶機;

2. 迭代查詢(反復(fù)查詢):

一般DNS 服務(wù)器之間屬迭代查詢,如:若DNS2不能響應(yīng)DNS1的請求,則它會將DNS3的IP 給DNS2,以便其再向DNS3發(fā)出請求;

舉例:比如學(xué)生問老師一個問題,王老師告訴他答案這之間的叫遞歸查詢。這期間也許王老師也不會,這時王老師問張老師,這之間的查詢叫迭代查詢!

不能在父域里面設(shè)定子域主機的A 記錄,因為dns 查詢過程是先查詢父域的,遇到子域的主機就自動通過NS 記錄轉(zhuǎn)到子域區(qū)文件里面去查詢了。

dns 查詢過程:以查詢[url]www.chinaunix.net[/url]為例

1 先到/etc/resolv.conf文件里面指定的域名服務(wù)器查詢,沒有相關(guān)記錄,所以通過named.ca 文件內(nèi)設(shè)置的根服務(wù)器(.)列表,返回一個根服務(wù)器IP 地址

2 到根服務(wù)器(.)查詢,同樣沒有。但是通過NS 記錄返回一個子域net 的域名服務(wù)器IP 地址 3 到net 子域服務(wù)器查詢,發(fā)現(xiàn)二級子域chinaunix.net 的NS 記錄(就是chinaunix 通過域名注冊機構(gòu)注冊的域名),返回一個chinaunix.net 子域服務(wù)器IP (chinaunix 內(nèi)部架設(shè)的dns 服務(wù)器)

4 到chinaunix.net 的dns 服務(wù)器查詢相應(yīng)主機[url]www.chinaunix.net[/url]。終于找到,順利返回相應(yīng)IP 地址。

5 查詢完畢. 到[url]www.chinaunix.net[/url]相應(yīng)主機的相應(yīng)端口進行連接。^_^

若你再見到你的老師,不妨請他告訴理論依據(jù)好讓你深入研究...

然而,教育的要旨,不在於接受而在於懷疑。

ns 授權(quán)很簡單...

假設(shè)你註冊的 domain 叫 abc.com ,而你有 ns1 與 ns2 兩臺 server 。

那,你必需從 .com 的權(quán)威伺服器授權(quán)給你,其設(shè)定或類似如此:

[Copy to clipboard] [ - ]CODE:

$ORIGIN com.

abc IN NS ns1.abc.com.

abc IN NS ns2.abc.com.

ns1.abc IN A 1.2.3.4

ns1.abc IN A 1.2.3.5

然後,你的 ns1 或 ns2 都可是權(quán)威伺服器了(各自的 SOA 設(shè)為自己即可) 。

在 abc.com 的db 中,最少還應(yīng)類似如下的設(shè)定:

,

[Copy to clipboard] [ - ]CODE:

$ORIGIN abc.com.

@ IN NS ns1.abc.com.

@ IN NS ns2.abc.com.

ns1 IN A 1.2.3.4

ns2 IN A 1.2.3.5

不過,既然 SOA 是自己的話,那事實上,我可以改變 ns 或增加 ns 授權(quán):

[Copy to clipboard] [ - ]CODE:

$ORIGIN abc.com.

@ IN NS ns1.abc.com.

@ IN NS ns2.abc.com.

@ IN NS ns3.abc.com.

ns1 IN A 1.2.3.4

ns2 IN A 1.2.3.5

ns3 IN A 1.2.3.6

假如你有 sub-zone 要授權(quán),事實上也是利用 ns 啦:

[Copy to clipboard] [ - ]CODE:

$ORIGIN abc.com.

sub1 IN NS ns1.sub1.abc.com.

sub1 IN NS ns2.sub1.abc.com.

ns1.sub1 IN A 4.3.2.1

ns2.sub1 IN A 4.3.2.2

然而,不同版本的 resolver ,對最終的 ns 判定是不一樣的:

bind9 是以 abc.com 的權(quán)威主機的 ns 為依據(jù),若找不到,那就沒結(jié)果。

而之前的版本,則可退而求次,以 com. 裡關(guān)於 abc.com 的 ns 為答案。

aclslave_servers { 192.168.0.2;192.168.0.3; };

zone "mydomain.com" {

type master;

file "mydomain.com.zone";

notify yes;

allow-transfer { slave_servers; };

also-notify { slave_servers; };

};

notify

If yes (the default), DNS NOTIFY messages are sent when a zone the server is authoritative for changes, see Section 3.3. The messages are sent to the servers listed in the zone’s NS records (except the master server identified in the SOA MNAME field), and to any servers listed in the also-notify option.

If explicit, notifies are sent only to servers explicitly listed using also-notify. If no, no notifies are sent.

,

The notify option may also be specified in the zone statement, in which case it overrides the options

notify statement. It would only be necessary to turn off this option if it caused slaves to crash.

6.2.14.6

also-notify

Defines a global list of IP addresses of name servers that are also sent NOTIFY messages whenever

a fresh copy of the zone is loaded, in addition to the servers listed in the zone’s NS records. This helps to ensure that copies of the zones will quickly converge on stealth servers. If an also-notify list is given in a zone statement, it will override the options also-notify statement. When a zone notify statement is set to no, the IP addresses in the global also-notify list will not be sent NOTIFY messages for that zone. The default is the empty list (no global notification list).

使用notify 指令會自動通知所有這個域的所有在ns 記錄上的機器,also-notify 指令可以用來通知所有不在ns 記錄上的dns 服務(wù)器。

標簽: