split分离解析:不同的ip地址访问相同的域名,得到不同的解析结果1、安装软件包
[root@localhost ~]#yum -y install bind bind-chroot caching-nameserver //安装dns
2、修改主配置文件
[root@localhost ~]# cd /var/named/chroot/etc/
[root@localhost etc]# vim named.conf
view yd_resolver {
match-clients { 172.100.100.11; }; //指定该ip地址访问
match-destinations { any; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
view lt_resolver {
match-clients { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.rfc.zones";
};
[root@localhost etc]# vim named.rfc1912.zones
...
zone "tarena.com" IN {
type master;
file "tarena.com.zone";
};
[root@localhost etc]# cp -p named.rfc1912.zones named.rfc.zones
[root@localhost etc]# vim named.rfc.zones
.. ..
zone ".tarena.com" IN {
type master;
file "lt.tarena.com.zone";
};
[root@localhost named]# vim tarena.com.zone
$TTL 86400
@ IN SOA tarena.com. root.tarena.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS dns1.tarena.com.
dns1 IN A 172.100.100.253
www IN A 2.2.2.2
[root@localhost named]# vim lt.tarena.com.zone
$TTL 86400
@ IN SOA lt.tarena.com. root.lt.tarena.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS dns1.lt.tarena.com.
dns1 IN A 172.100.100.253
www IN A 1.1.1.1
[root@localhost ~]# service named restart
[root@localhost ~]#chkconfig named on
3、客户机测试:
客户机1:
[root@localhost ~]# host www.tarena.com 172.100.100.253
客户机2:
win7: nslookup www.tarena.com