安装依赖包:
yum install bind*
配置/etc/named.conf
[root@dg01 ~]# cat /etc/named.conf // // named.conf // // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS // server as a caching only nameserver (as a localhost DNS resolver only). // // See /usr/share/doc/bind*/sample/ for example named configuration files. // 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"; allow-query { any; }; recursion yes; dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto; /* Path to ISC DLV key */ bindkeys-file "/etc/named.iscdlv.key"; managed-keys-directory "/var/named/dynamic"; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; zone "." IN { type hint; file "named.ca"; }; include "/etc/named.rfc1912.zones"; //include "/etc/named.root.key"; //include "/etc/racdb-scan.zones";
配置/etc/named.rfc1912.zones
[root@dg01 ~]# cat /etc/named.rfc1912.zones zone "racdb-scan" IN { type master; file "racdb-scan_zone"; allow-update { none; }; }; zone "56.168.192.in-addr.arpa" IN { type master; file "192.168.56.zone"; allow-update { none; }; };
配置/var/named/racdb-scan_zone
[root@dg01 ~]# cat /var/named/racdb-scan_zone $TTL 86400 @ IN SOA racdb-scan root.racdb-scan. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum @ IN NS racdb-scan. IN A 192.168.56.15 IN A 192.168.56.16 IN A 192.168.56.17
配置/var/named/192.168.56.zone
[root@dg01 ~]# cat /var/named/192.168.56.zone $TTL 86400 @ IN SOA racdb-scan root.racdb-scan. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum @ IN NS racdb-scan. 15 IN PTR racdb-scan 16 IN PTR racdb-scan 17 IN PTR racdb-scan
然后启动服务:
[root@dg01 ~]# service named start Starting named: named: already running [ OK ]
检查正向解析:
[root@dg01 ~]# nslookup racdb-scan Server: 192.168.56.21 Address: 192.168.56.21#53 Name: racdb-scan Address: 192.168.56.17 Name: racdb-scan Address: 192.168.56.15 Name: racdb-scan Address: 192.168.56.16
检查反向解析:
[root@dg01 ~]# nslookup 192.168.56.15 Server: 192.168.56.21 Address: 192.168.56.21#53 15.56.168.192.in-addr.arpa name = racdb-scan.56.168.192.in-addr.arpa. [root@dg01 ~]# nslookup 192.168.56.16 Server: 192.168.56.21 Address: 192.168.56.21#53 16.56.168.192.in-addr.arpa name = racdb-scan.56.168.192.in-addr.arpa. [root@dg01 ~]# nslookup 192.168.56.17 Server: 192.168.56.21 Address: 192.168.56.21#53 17.56.168.192.in-addr.arpa name = racdb-scan.56.168.192.in-addr.arpa.