一、何为DNS转发器及其用处?
DNS转发器就是实现本地DNS无法正常解析到的请求,转发给另一个已经配置好的DNS服务器,当然也可以实现对特定的区域(域名)做解析时候直接转发,而本地无需维护该区域文件。
一、实验需要
192.168.220.100作为本地DNS服务器
192.168.220.101作为解析jeffery.com.的DNS服务器
windows7,DNS指向192.168.220.100,请求解析www.jeffery.com
本地DNS实现将请求转发至192.168.220.101上获取解析,再返回客户端
二、配置
①192.168.220.100----本地DNS配置
/etc/named.conf
options { directory "/var/named/"; }; zone "." IN { type hint; file "named.ca"; }; zone "localhost" IN { type master; file "named.localhost"; }; zone "0.0.127.in-addr.arpa" IN { type master; file "named.loopback"; }; zone "jeffery.com" IN { ##定义jeffery.com为转发域 type forward; ##该区域本地DNS类型为转发器 forwarders { 192.168.220.101; }; ##转发的接受者ip };
②192.168.220.101-----负责解析jeffery.comDNS服务器配置
/etc/named.conf
options { directory "/var/named/"; }; zone "." IN { type hint; file "named.ca"; }; zone "localhost" IN { type master; file "named.localhost"; }; zone "0.0.127.in-addr.arpa" IN { type master; file "named.loopback"; }; zone "jeffery.com" IN { ##jeffery.com.区域的配置 type master; ##类型为主 file "jeffery.com.zone"; ##区域位置的名称+位置 };
/var/named/jeffery.com.zone
$TTL 1D @ IN SOA ns.jeffery.com. admin.jeffery.com. ( 200 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum IN NS ns.jeffery.com. ns IN A 192.168.220.101 www IN A 3.3.3.3 ftp IN A 4.4.4.4
测试:
-----------------------------------------------------------------------
-----------------------上述实验只是针对特定区域的转发,如果将转发配置在options{}中则表示全局意义,当正常解析无法实现的时候,才会将任意区域都转发到特定的已经配置的主机上。