典型场景是 内外网分离解析 / split-horizon DNS / split-brain DNS:
-
内网客户端访问
www.example.com→ 返回192.168.1.10 -
外网客户端访问
www.example.com→ 返回203.0.113.10 -
测试环境访问同一域名 → 返回测试 IP
acl "internal" {
10.0.0.0/8;
192.168.0.0/16;
127.0.0.1;
};view "internal" {
match-clients { internal; };
recursion yes;
allow-recursion { internal; };zone "example.com" {
type master;
file "/etc/bind/db.example.com.internal";
};zone "." {
type hint;
file "/etc/bind/db.root";
};
};view "external" {
match-clients { any; };
recursion no;zone "example.com" {
type master;
file "/etc/bind/db.example.com.external";
};zone "." {
type hint;
file "/etc/bind/db.root";
};
};