1 實驗準備:A主機作爲主DNS解析服務器並且需要實現分離解析,ip地址爲:192.168.10.10,B作爲子域DNS服務器,ip地址爲192.168.10.12,win7主機作爲客戶機測試,ip地址爲:192.168.10.99;域名地址:single.com
2,查看父域主機軟件是否安裝
[root@ser1 ~]# rpm -q bind bind-chrootcaching-nameserver
package bind is not installed
package bind-chroot is not installed
package caching-nameserver is not installed 軟件未安裝
3,安裝所需軟件
[root@ser1 ~]# yum install -y bind
4,創建並編輯父域服務器主配置文件
(1)配置監聽端口及網絡有關限制
[root@ser1 ~]# cd /var/named/chroot/etc/
[root@ser1 etc]# cp –p named.caching-nameserver.conf named.conf
[root@ser1 etc]# vim named.conf
options {
listen-on port 53 { 192.168.10.10; };
listen-on-v6 port 53 { ::1; };
allow-query { any; };
allow-query-cache{ any; };
view lt_resolver {
match-clients { any; };
match-destinations { any; };
(2)配置分離解析
接(1)
view localhost_resolver {
match-clients { 192.168.10.99; };
match-destinations { any; };
include"/etc/named.rfc1912.zones";
};
view yd_resolver {
match-clients { any; };
match-destinations { any; };
include"/etc/named.rfc1913.zones";
};
~
[root@ser1 etc]# vim named.rfc1912.zones
zone "single.com" IN {
typemaster;
file"single.com.zone";
};
zone "10.168.192.in-addr.arpa" IN {
typemaster;
file"192.168.10.arpa";
};
5, 創建named.rfc1913.zones文件並編輯
[root@ser1 etc]# cp -p named.rfc1912.zones named.rfc1913.zones
[root@ser1 etc]# vimnamed.rfc1913.zones
zone "single.com" IN {
typemaster;
file"single1.com.zone";
};
zone "10.168.192.in-addr.arpa" IN {
typemaster;
file"192.168.101.arpa";
};
6,配置區域配置文件
(1)配置子域授權正反向解析文件
[root@ser1 named]# cp -p named.local single.com.zone
[root@ser1 named]# vim single.com.zone
$TTL 86400
@ IN SOA single.com. root.single.com. (
2014030801 ;
28800 ;
14400 ;
3600000 ;
86400 ) ;
IN NS dns1.single.com.
bg.single.com. IN NS dns1.bg.single.com.
dns1.bg.single.com. IN A 192.168.10.12
dns1 IN A 192.168.10.10
www IN A 192.168.10.11
[root@ser1 named]# cp -p single.com.zone192.168.10.arpa
[root@ser1 named]# vim 192.168.10.arpa
$TTL 86400
@ IN SOA single.com. root.single.com. (
2014030801; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400) ; Minimum
IN NS dns1.single.com.
10 IN PTR dns1.single.com.
11 IN PTR www.single.com.
(2)配置分離解析正反向解析文件
[root@ser1 named]# cp -psingle.com.zonesingle1.com.zone
[root@ser1 named]# vim single1.com.zone
$TTL 86400
@ IN SOA single.com. root.single.com. (
2014030801 ;
28800 ;
14400 ;
3600000 ;
86400) ;
IN NS dns1.single.com.
bg.single.com. IN NS dns1.bg.single.com.
dns1.bg.single.com. IN A 192.168.10.12
dns1 IN A 192.168.10.10
www IN A 192.168.10.13
[root@ser1 named]# cp -p 192.168.10.arpa192.168.101.arpa
[root@ser1 named]# vim 192.168.101.arpa
$TTL 86400
@ IN SOA single.com. root.single.com. (
2014030801 ;
28800 ;
14400 ;
3600000 ;
86400) ;
IN NS dns1.single.com.
10 IN PTR dns1.single.com.
13 IN PTR www.single.com.
7,開啓父域服務器
[root@ser1 named]# servicenamed start
啓動named: [確定]
[root@ser1 named]# chkconfignamed on
8,配置子域服務器
(1)安裝軟件
[root@localhost ~]# yuminstall -y bind bind-chroot caching-nameserver
(2)創建編輯主配置文件
[root@localhost ~]# cd /var/named/chroot/etc/
[root@localhost etc]# cp -pnamed.caching-nameserver.conf named.conf
[root@localhost etc]# vimnamed.conf
options {
listen-on port 53 { 192.168.10.12; };
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 {192.168.10.10; }……[如果讓子域服務器解析到父域裏的主機則需要添加此條授權]
view localhost_resolver {
match-clients { any; };
match-destinations { any; };
[root@localhost etc]# vim named.rfc1912.zones
zone "bg.single.com" IN {
typemaster;
file"bg.single.com.zone";
};
zone "192.168.10.in-addr.arpa" IN {
typemaster;
file"192.168.10.arpa";
};
(3)創建並編輯區域配置文件
[root@localhost named]# vimbg.single.com.zone
$TTL 86400
@ IN SOA bg.single.com. root.bg.single.com. (
2014030801 ;
28800 ;
14400 ;
3600000 ;
86400);
IN NS dns1.bg.single.com.
dns1 IN A 192.168.10.12
www IN A 192.168.10.15
[root@localhost named]# vim 192.168.10.arpa
$TTL 86400
@ IN SOA bg.single.com. root.bg.single.com. (
2014030801 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400) ; Minimum
IN NS dns1.bg.single.com.
12 IN PTR dns1.bg.single.com.
15 IN PTR www.bg.single.com.
(4)開啓子域服務器
[root@localhost named]# servicenamed start
啓動named: [確定]
[root@localhost named]# chkconfignamed on