CentOS安装Bind

1158阅读 0评论2011-08-10 308938969
分类:LINUX

本文所说方法为yum安装,使用name caching方式。其他方法后续有机会再补完吧

01、首先使用yum方式安装所需的程序包:yum install bind bind-chroot caching-nameserver -y

02、进入bind的目录,并复制控制文件:
cd /var/named/chroot/etc;
cp named.caching-nameserver.conf named.conf

03、编辑named.conf文件:vi named.conf

options { listen-on port 53 { any; }; listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; forwarders { 8.8.8.8; 202.106.0.20; }; // Those options should be used carefully because they disable port // randomization // query-source port 53; // query-source-v6 port 53; allow-query { any; }; allow-query-cache { any; }; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; view localhost_resolver { match-clients { any; }; match-destinations { any; }; recursion yes; include "/etc/named.rfc1912.zones"; };

04、编辑vi named.rfc1912.zones
如果是主DNS

zone "abc.com" { type master; file "abc.com.zone"; allow-transfer{192.168.1.2;}; }; zone "33.22.11.in-addr.arpa" { type master; file "11.22.33.rev"; allow-transfer{192.168.1.2;}; };

如果是辅DNS

zone "abc.com" { type slave; file "abc.com.zone"; Masters{192.168.1.1;}; }; zone "33.22.11.in-addr.arpa" { type slave; file "11.22.33.rev"; Masters{192.168.1.1;}; };

05、编辑上面配置文件中提到的abc.com.zone文件
cd /var/named/chroot/var/named
vi abc.com.zone

1 2 3 4 5 6 7 8 9 10 11 $TTL 86400 @ IN SOA localhost. root.localhost. ( 20110312 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Minimum $ORIGIN abc.com. IN NS dns.abc.com. dns IN A 192.168.1.1 www IN A 192.168.1.1

06、启动服务:service named start

07、将服务设置为开机自启

1 2 3 4 5 [root@test]chkconfig --list named named 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@test]chkconfig --level 345 named on [root@test]chkconfig --list named named 0:off 1:off 2:off 3:on 4:on 5:on 6:off

08、至此域名服务器基本搭建完成了~

上一篇:rndc: ‘reload’ failed: not found解决
下一篇:Fedora9 下搭建Qt Creator的ARM开发环境并移植Qt4.6.3