今天我们来尝试在REHEL6.5上搭建DNS服务器,并开启两台Win7作为客户机,一台作为内网IP:192.168.100.100,一台作为外网IP:12.0.0.12,实现DNS分离解析。
安装bind软件包:
[root@server1 ~]# rpm -ivh /mnt/Packages/bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
编辑主配置文件:
[root@server1 ~]# vim /etc/named.conf options { listen-on port 53 { any; }; #修改为any # listen-on-v6 port 53 { ::1; }; #以"#"注释掉这行,不监听ipv6地址 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; }; #实验下修改为any,为任何主机 recursion yes; ##省略部分代码信息## ##下面的根域服务器配置删除##会和配置的分离解析冲突 zone "." IN { type hint; file "named.ca"; };
编辑区域配置文件:
[root@server1 ~]# vim /etc/named.rfc1912.zones // // See /usr/share/doc/bind*/sample/ for example named configuration files. // ##全部删除,用view划分两个容器,把所有的zone放进去 view "lan" { match-clients { 192.168.100.0/24;192.168.110.0/24; }; zone "wzn.com" IN { type master; file "wzn.com.zone.lan"; }; zone "." IN { type hint; file "named.ca"; }; }; view "wan" { match-clients { any; }; zone "wzn.com" IN { type master; file "wzn.com.zone.wan"; }; };
编辑区域数据配置文件:
复制配置文件模板,并复制重命名两份新的配置文件:
[root@server1 ~]# cd /var/named/ [root@server1 named]# ls data named.ca named.localhost slaves dynamic named.empty named.loopback [root@server1 named]# cp -p named.localhost wzn.com.zone.lan [root@server1 named]# cp -p named.localhost wzn.com.zone.wan
编辑内网数据配置文件:
[root@server1 named]# vim wzn.com.zone.lan $TTL 1D @ IN SOA wzn.com. admin.wzn.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS wzn.com. A 192.168.100.1 www IN A 192.168.100.88 mail IN A 192.168.100.99
编辑外网数据配置文件:
[root@server1 named]# vim wzn.com.zone.wan $TTL 1D @ IN SOA wzn.com. admin.wzn.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS wzn.com. A 12.0.0.1 www IN A 12.0.0.1 mail IN A 12.0.0.1
开启服务,关闭防火墙。用两台Win7宿主机试着去访问看看我们搭建的DNS服务器是否可以进行分离解析。
结果如下:
原文地址:http://blog.51cto.com/13625676/2119785