bind9的安装
bind9的安装,bind9的安装
1.先从 http://www.isc.org/products/BIND/ 下载bind,我下载的是bind-9.3.1.tar.gz2.我下载的文件放在/home/tomcat目录下3.进入目录解压缩#tar -xzfz bind-9.3.1.tar.gz -C /usr/local/src4.进入安装目录 # cd bind-9.3.15.配置、编译 # ./configure # make6.安装 # make install7.生成的可执行文件位于/usr/local/sbin目录下。最重要的可执行文件为named和rndc。8.创建链接 # ln -s /usr/local/sbin/rndc /usr/sbin/rndc # ln -s /usr/local/sbin/named /usr/sbin/named9.创建rndc.conf配置文件。 # /usr/local/sbin/rndc-confgen > /etc/rndc.conf # cat /etc/rndc.conf 输出为: # Start of rndc.conf key "rndc-key" { algorithm hmac-md5; secret "y9xvvfQjdWv9f/Fo7wquBg=="; }; 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 "y9xvvfQjdWv9f/Fo7wquBg=="; # }; # # controls { # inet 127.0.0.1 port 953 # allow { 127.0.0.1; } keys { "rndc-key"; }; # }; # End of named.conf10.创建rndc.key文件。将rndc.conf文件中注释部分拷贝生成如下文件: # vi /etc/rndc.key key "rndc-key" { algorithm hmac-md5; secret "y9xvvfQjdWv9f/Fo7wquBg=="; }; controls { inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndc-key"; }; }; 检查rndc是否正常工作: #/usr/local/sbin/named -g Jan 11 11:56:45.075 starting BIND 9.2.3 -g Jan 11 11:56:45.076 using 1 CPU Jan 11 11:56:45.079 loading configuration from '/etc/named.conf' ...... #/usr/local/sbin/rndc status11.创建named.conf配置文件。# vi /etc/named.conf // generated by named-bootconf.pl options { directory "/var/named"; /* * If there is a firewall between you and nameservers you want * to talk to, you might need to uncomment the query-source * directive below. Previous versions of BIND always asked * questions using port 53, but BIND 8.1 uses an unprivileged * port by default. */ // query-source address * port 53; }; // // a caching only nameserver config // zone "." IN { type hint; file "named.root"; }; zone "localhost" IN { type master; file "localhost.zone"; allow-update { none; }; }; zone "0.0.127.in-addr.arpa" IN { type master; file "named.local"; allow-update { none; }; }; zone "duanfenglei.com" IN { //新加duanfenglei.com的域 type master; file "duanfenglei.com.zone"; allow-update { none; }; }; zone "9.168.192.in-addr.arpa" IN { //新加域的反向解析 type master; file "named.192.168.9"; allow-update { none; }; }; include "/etc/rndc.key";12.创建/var/named目录 # mkdir /var/named # cd /var/named13.匿名登录到ftp站点FTP.RS.INTERNIC.NET,获取/domain目录下的named.root文件和named.ca文件,将该文件置于/var/named目录下。14.创建localhost.zone文件# vi /var/named/localhost.zone $TTL 86400 $ORIGIN localhost. @ 1D IN SOA @ root ( 42 ; serial (d. adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum 1D IN NS @ 1D IN A 127.0.0.115.创建named.local文件 # vi named.local $TTL 86400 @ IN SOA localhost. root.localhost. ( 1997022700 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Minimum IN NS localhost. 1 IN PTR localhost.[root@linux etc]# mkdir /var/named进入/var/named[root@linux etc]# cd /var/named建立localhost.zone文件[root@linux named]#vi localhost.zone$TTL 86400$ORIGIN localhost.@ 1D IN SOA @ root ( 42 ; serial (d. adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum 1D IN NS @ 1D IN A 127.0.0.1建立named.local文件[root@linux named]#vi named.local$TTL 86400@ IN SOA localhost. root.localhost. ( 1997022700 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 61.177.252 ; Expire 86400 ) ; Minimum IN NS localhost.1 IN PTR localhost.16.创建duanfenglei.com.zone文件 # vi duanfenglei.zone $TTL 1D@ IN SOA duanfenglei.com. root.duanfenglei.com. ( 1053891162 3H 15M 1W 1D ) IN NS duanfenglei.com. IN MX 5 duanfenglei.com.www IN A 192.168.9.917.创建named.192.168.9文件 # vi named.192.168.9 $TTL 86400@ IN SOA duanfenglei.com. root.duanfenglei.com.(20031001;7200;3600;43200;86400);@ IN NS duanfenglei.com.9 IN PTR dns.duanfenglei.com.18.启动#named -c /etc/named.conf &19.测试反向解析是否成功[root@testserver61 named]# host 192.168.9.99.9.168.192.in-addr.arpa domain name pointer dn