1.環境:
OS: CentOS 5.5
套件:bind-9.3.6-4.P1.el5_4.2
bind-utils-9.3.6-4.P1.el5_4.2
bind-chroot-9.3.6-4.P1.el5_4.2
2.設定:
#cd /var/named/chroot //預設啟動chroot
#ls
//如果沒有 var與etc或有但沒有應有檔案,需到/usr/share/doc/bind-9.3.6/sample/
中將這兩個目錄拷貝回來
# cp /usr/share/doc/bind-9.3.6/sample/* . -rf
# /usr/sbin/dns-keygen //記得先做這個動作,將key放到named.conf中
ZOjwOIHPkDlcEzHNkHUbtjCeKWCgzOeqKIUQgV4ZK9p4an7ELNBSZNKn3g5w
# vim etc/named.conf //放入下面這段
key ddns_key
{
algorithm hmac-md5;
secret "ZOjwOIHPkDlcEzHNkHUbtjCeKWCgzOeqKIUQgV4ZK9p4an7ELNBSZNKn3g5w";
};
<1>以localhost練習
#vim etc/named.conf //可看到 view "localhost-resolver"段有一個設定
include "/etc/named.rfc1912.zones"; //代表與localhost相關的zone設定檔
#vim /etc/named.rfc1912.zones
加入:
zone "marcus.org" IN {
type master;
file "named.marcus"; //資源設定檔位置,預設在var/named/
allow-update { none; };
};
#cp var/named/localhost.zone /var/named/named.marcus //用範例檔來做
#vim /var/named/named.marcus
修改成:
$TTL 86400 @ IN SOA @ root ( 42 ; serial (d. adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN NS @ IN A 140.137.215.105 www IN A 140.137.215.105 |
#dig www.marcus.org @localhost
結果:
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> www.marcus.org @localhost ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7168 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;www.marcus.org. IN A ;; ANSWER SECTION: www.marcus.org. 86400 IN A 140.137.215.105 ;; AUTHORITY SECTION: marcus.org. 86400 IN NS marcus.org. ;; ADDITIONAL SECTION: marcus.org. 86400 IN A 140.137.215.105 ;; Query time: 1 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Fri Oct 22 22:09:33 2010 ;; MSG SIZE rcvd: 78 |
代表設定正常
<2>如果要對外服務,將zone資料放到named.conf的view "external"區段即可
沒有留言:
張貼留言