DNS view的实现
DNS服务器:192.168.0.1
dx客户端:192.168.0.2
wt客户端:192.168.0.3
vim /var/named/chroot/etc/named.conf
修改
listen-on port 53 { 192.168.0.1; };
allow-query { any; };
增加
include "/etc/dx.cfg";
include "/etc/wt.cfg";
view dxzone {
match-clients {dx; };
recursion yes;
zone "uplooking.com" {
type master;
file "dx/test.com.zone";
};
};
view wtzone {
match-clients {wt; };
recursion yes;
zone "uplooking.com" {
type master;
file "wt/test.com.zone";
};
};
view otherzone {
match-clients {any; };
recursion yes;
zone "uplooking.com" {
type master;
file "other/test.com.zone";
};
};
cd /var/named/chroot/etc/
echo "acl dx { 192.168.0.2; };" > dx.cfg
echo "acl wt { 192.168.0.3; };" > wt.cfg
cd /var/named/chroot/var/named
mkdir dx wt others
创建3个目录下的zone文件:test.com.zone并将他们指向不同的主机。
重启DNS服务
/etc/init.d/named restart