用 bind 9.xx 的 view 功能可以实现 dns 对不同网段返回不同的地址
named.conf 有以下内容:
-------------------------------------------------------------------
view "internal" {
// This should match our internal networks.
match-clients { 10.0.0.0/8; };
// Provide recursive service to internal clients only.
recursion yes;
zone "." {
type hint;
file "/etc/namedb/named.root";
};
zone "0.0.127.IN-ADDR.ARPA" {
type master;
file "/etc/namedb/localhost.rev";
};
// Provide a complete view of the mydomain.com zone
// including addresses of internal hosts.
zone "mydomain.com" {
type master;
file "/etc/namedb/zone.mydomain.com.internal";
};
};
view "external" {
match-clients { any; };
// Refuse recursive service to external clients.
recursion no;
// Provide a restricted view of the mydomain.com zone
// containing only publicly accessible hosts.
zone "mydomain.com" {
type master;
file "/etc/namedb/zone.mydomain.com.external";
};
};
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15149581/viewspace-671313/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/15149581/viewspace-671313/