1.为区域linuxidc.com配置分离解析,针对的A记录做分离测试。
2.当客户机来自内部用户192.168.100.0/24时,将解析为192.168.100.250。
3.当客户机来自外部用户其他网络时,将解析为100.100.100.100。
实现:为了简化实验网络结构,提供分离解析的DNS服务器配置有2个IP地址192.168.100.1/24(对内)和10.10.10.8/24(对外),以便模拟内部用户和外部用户连接。
推荐阅读:
BIND+DLZ+MySQL智能DNS的正向解析和反向解析实现方法
Ubuntu BIND9泛域名解析配置
CentOS 5.2下安装BIND9.6
----------------------------------------------分割线----------------------------------------------
一.安装软件包
# yum -y install bind bind-chroot
二.修改主配置文件
# vim /etc/named.conf
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
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;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
acl "lan" { 192.168.100.0/24; }; //定义内网acl
acl "wan" { ! 192.168.100.0/24; any;}; //定义外网acl
view lan { //定义视图lan
match-clients { lan; }; //适用于lan定义的客户机地址
zone "." IN { //一定要写在VIEW里面
type hint;
file "named.ca";
};
zone "linuxidc.com" {
type master;
file "lan.zone"; //视图lan的数据文件
};
};
view wan {
match-clients { wan; };
zone "." IN {
type hint;
file "named.ca";
};
zone "linuxidc.com" {
type master;
file "wan.zone";
};
};
include "/etc/named.root.key";