bind9当作为缓存服务器时可以使用转发区的方式
方式如下:
1. 直接在named.conf配置文件的option部分配置,此配置对应的是整体全局。
options {
listen-on port 53 { 192.168.199.173; };
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";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { any; };
forward only;
forwarders { 223.5.5.5; 223.6.6.6; };
recursion yes;
dnssec-enable no;
dnssec-validation no;
bindkeys-file "/etc/named.root.key";
managed-keys-directory "/var/named/dynamic";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
};
... ...
... ...
2. 在每一个转发区部分配置,此时对应的是每一个转发区的配置:
view external{
match-clients {externet;};
recursion yes;
zone "." IN{
type hint;
file "/root/bind/bind-build/etc/named.root";
};
zone "llg.com" IN{
type forward;
Forward only;
Forwarders {192.168.9.231;};
};
};
forward only/first | 若值为 only,则服务器缓存数据并查询转发器,但从不查询其他的任何服务器,若转发器不能响应查询则查询失败; 若值为 first,则在转发查询失败或没有查到结果时,会在本地发起正常查询。默认为 first |