1、bind配置:


/var/named/chroot/etc/named.conf


listen-on port 53 { 192.168.1.254; };

forwarders { 202.101.172.35; };
forward  only;

zone "test.com" IN {
       type forward;
       forwarders { 127.0.0.1; };
};



2、dnsmasq配置:


resolv-file=/etc/resolv.dnsmasq.conf   //使用自定义的nameserver文件
listen-address=127.0.0.1                     //监听IP,和bind监控的ip区分开    
bind-interfaces                                  //绑定开关
no-hosts                                            //不使用默认的/etc/hosts
addn-hosts=/etc/dnsmasq_hosts       //使用其他的自定义文件

mx-host=sky-mobi.com,pop.sky-mobi.com,50    //指定域sky-mobi.com的mx记录及优先级
localmx                                             //返还mx记录
conf-dir=/etc/dnsmasq.d



3、创建/etc/resolv.dnsmasq.conf


nameserver 8.8.8.8



4、创建/etc/dnsmasq_hosts


192.168.1.250  pop.test.com
192.168.1.250  test.com



     以上操作,就可以实现test域中pop.test.com及test.com的解析指向192.168.1.250,而域test其他主机解析,正常由bind正常转发并解析。


5、客房机测试:

dig test.com @192.168.1.254

dig pop.test.com @192.168.1.254

dig mx test.com @192.168.1.254