DNS 根据不同网段做不同DNS解析

vim /etc/named.conf
options {
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; };
recursion yes;
allow-transfer { none; };
};
acl intranet { 192.168.100.0/24; }; <==针对 intranet 给予的来源 IP 指定
acl internet { ! 192.168.100.0/24; any; }; <==加上惊叹号 (!) 代表反向选择的意思
view "lan" { <==只是一个名字,代表的是内网
match-clients { "intranet"; }; <==吻合这个来源的才使用底下的 zone
zone "." IN {
type hint;
file "named.ca";
};
zone "centos.vbird" IN {
type master;
file "named.centos.vbird";
allow-transfer { 192.168.100.10; };
};
zone "100.168.192.in-addr.arpa" IN {
type master;
file "named.192.168.100";
allow-transfer { 192.168.100.10; };
};
};
view "wan" { <==同样,只是个名字而已!
match-clients { "internet"; }; <==代表的则是外网的 internet 来源
zone "." IN {
type hint;
file "named.ca";
};
zone "centos.vbird" IN {
type master;
file "named.centos.vbird.inter"; <==档名必须与原有的不同!
};
};

上一篇:Nginx高级应用--负载均衡、rewrite规则


下一篇:Python输入输出