1.產生 rndc.conf 檔
# rndc-confgen > /etc/rndc.conf
此時就會產生下列資料,並且寫到 etc/rndc.conf 內
# Start of rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "l6zE+CnSFuteQHxYwIGQqq==";
};
options {
default-key "rndc-key";
default-server 127.0.0.1;
default-port 953;
};
# End of rndc.conf
# Use with the following in named.conf, adjusting the allow list as needed:
# key "rndc-key"
# algorithm hmac-md5;
# secret "l6zE+CnSFuteQHxYwIGQqq==";
# };
#
# controls {
# inet 127.0.0.1 port 953
# allow { 127.0.0.1; } keys { "rndc-key"; };
# };
# End of named.conf
另外將下列內容,複製到 /etc/named.conf 內
key "rndc-key" {
algorithm hmac-md5;
secret "l6zE+CnSFuteQHxYwIGQqq==";
};
controls {
inet 127.0.0.1 port 953
allow {127.0.0.1; } keys {"rndc-key";};
};
2.設定 /var/named.conf 檔
以下為 named.conf 的內容
options { directory "/var/named";
# 設定[網域設定檔的存放目錄]pid-file "/var/run/named.pid";
# 紀錄 name server 執行時的PID編號allow-transfer {none;}; }; ################################################################# key "rndc-key" { algorithm hmac-md5; secret "l6zE+CnSFuteQHxYwIGQqq=="; }; controls { inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndc-key"; }; }; ################################################################# zone "." IN { type hint; file "named.root"; };
/* * 根網域設定檔named.root,可至 * ftp://ftp.internic.net/domain/ * 下載 named.root 或 named.cache 都可以, * 下載後,存到您的[網域設定檔的存放目錄]內 */################################################################# zone "localhost" IN { type master; file "localhost-dns"; };
/* * 本機正解設定擋,自行在 * 您設定的[網域設定檔的存放目錄]內建立, * 檔名自取,這裡取名為 localhost-dns */
zone "0.0.127.in-addr.arpa" IN { type master; file "localhost-arpa"; };
/* * 本機反解設定擋,自行在 * 您設定的[網域設定檔的存放目錄]內建立, *檔名自取,這裡取名為 localhost-arpa */################################################################# zone "zlnet.net" IN { type master; file "test-dns"; };
/* * 網域正解設定擋,自行在 * 您設定的[網域設定檔的存放目錄]內建立, * 檔名自取,這裡取名為 test-dns */zone "1.168.192.in-addr.arpa" IN { type master; file "test-arpa"; };
//網域反解設定擋,自行在 //您設定的[網域設定檔的存放目錄]內建立, //檔名自取,這裡取名為 test-arpa################################################################
3.建立本機正解,檔名為 localhost
# vi /var/named/localhost
$TTL
3h@ IN SOA localhost. root.localhost. (
2009031424;
3h;
1h;
1w;
1h);
@ IN NS loclahost.
localhost. IN A 127.0.0.1
4.建立本機反解,檔名為 100127
# vi /var/named/100127
@ IN SOA localhost. root.localhost. (
2009031424;
3h;
1h;
1w;
1h);
@ IN NS localhost.
1 IN PTR localhost.
5.建立網域正解,檔名為 test-dns
# vi /var/named/test-dns
@ IN SOA abc.test.org. abc.yahoo.com.tw. (
2009031424;
3h;
1h;
1w;
1h);
@ IN NS abc.test.org.
abc IN A 192.168.1.88
@ IN A 192.168.1.88
@ IN MX 10 abc.test.org.
www IN CNAME abc.test.org.
6.建立網域反解,檔名為 test-arpa
# vi /var/named/test-arpa
@ IN SOA abc.test.org. abc.yahoo.com.tw. (
2009031424;
3h;
1h;
1w;
1h);
@ IN NS abc.test.org.
88 IN PTR abc.test.org.
7.起動 BIND
# cd /etc/rc.d
# chmod 755 rc.bind