作者: Song (song) 看板: dns
標題: [測試] rndc.conf
時間: Sun Aug 26 10:22:43 2001
Bind 9 的 rndc 就如同舊版的 ndc 是一樣的用途,
而 rndc 的 'r' 是 remote 的意思,所以 rndc 還可以控管到
遠端的 server 上去。
rndc 需要設定 /etc/rndc.conf,且在 /etc/named.conf 上也需要配合,
以本地端使用為例:
--- /etc/rndc.conf ---
key localhost {
algorithm "hmac-md5";
secret "SFhfWe9oUrOPkyNKExZWpg==";
};
options {
default-server localhost;
default-key localhost;
};
server localhost {
key localhost;
};
--- --- --- --- --- ---
其中 key statement 裡的 secret "SFhfWe9oUrOPkyNKExZWpg==";
是用 dnssec-keygen 製作出來的,語法如下:
dnssec-keygen -a hmac-md5 -b 128 -n HOST localhost
這樣會得到 2 個檔案 :
Klocalhost.+157+03077.key
Klocalhost.+157+03077.private
# cat Klocalhost.+157+03077.key
localhost. IN KEY 512 3 157 SFhfWe9oUrOPkyNKExZWpg==
# cat Klocalhost.+157+03077.private
Private-key-format: v1.2
Algorithm: 157 (HMAC_MD5)
Key: SFhfWe9oUrOPkyNKExZWpg==
這兩個檔案格式不同,但都可以看到用 HMAC_MD5 演算法產生的 secret
然後將這組 secret 複製到 /etc/rndc.conf 的 key statement 裡去。
接下來是 /etc/named.conf 裡需要配合的部分:
--- /etc/named.conf ---
key localhost {
algorithm "hmac-md5";
secret "SFhfWe9oUrOPkyNKExZWpg==";
};
controls {
inet 127.0.0.1 allow { localhost; } keys { localhost; };
};
--- --- --- --- --- ---
可以看到 /etc/named.conf 裡的 key statement 與 /etc/rndc.conf 的
是一樣的。
主要的是在 controls statement。
在 IP (127.0.0.1) 之後沒有指定 port port_num 則內定值是 port 953。
改完 /etc/named.conf 之後將 named 啟動,再來就可以用 rndc 了。
在命令列輸入 rndc 不帶參數就會列出 usage :
# rndc
Usage: rndc [-c config] [-s server] [-p port] [-y key] command
command is one of the following:
reload Reload configuration file and zones.
reload zone [class [view]]
Reload a single zone.
refresh zone [class [view]]
Schedule immediate maintenance for a zone.
stats Write server statistics to the statistics file.
querylog Toggle query logging.
dumpdb Dump cache(s) to the dump file (named_dump.db).
stop Save pending updates to master files and stop the server.
halt Stop the server without saving pending updates.
*status Display ps(1) status of named.
*trace Increment debugging level by one.
*notrace Set debugging level to 0.
*restart Restart the server.
* == not yet implemented
Version: 9.1.2
--
:)
========== Song Huang ==========
泉涸,魚相與處於陸,
相呴以濕,相濡以沫,
不如相忘於江湖。
--
[1;32m※ Origin: [33m碩誠資訊 [37m [m
[1;31m◆ From: [36mwww.jrlin.com.tw[m
※ X-Info: Song -> Song@yanghsin.com.tw
※ X-Sign: 0TOGNKFM0KVbTZQpsgog (01/08/26 10:27:27 )
---------
|