阅读内容

双重dns服务器配置指南

[日期:2007-09-15] 来源:Linux公社  作者:Linuxidc


相信现在有不少地方都是起双重DNS的 即对外解析成公网地址 对内解析成内网地址 一般的做法是用两台DNS服务器分开来做的

但如果机器紧张,只有一台的话 或出于安全考虑的话 其实也是可以做的 这里又分两种情况: 使用Bind8和Bind9的做法是不一样的,

Bind8的话,原理很简单

在DNS服务器上运行两个BIND,分别为来自内部网络和外部网络的域名请求提供解析,每个BIND具有不同的配置文件和域名数据库文件,并分别在不同的端口监听。DNS服务器在接到客户端请求时,根据客户的IP地址将请求重定向到不同的BIND服务端口,这样就可以根据客户端的IP地址将不同的解析结果返回给客户端,而整个过程对于客户端来说都是透明的。实现的关键在于运行两个BIND及运用iptables命令进行IP地址及端口改写操作。

具体配置的话:

在/etc/下生成两个named配置文件named.in与named.out

named.in

代码:

## named.conf - configuration for bind(named.in) 
#
# Generated automatically by redhat-config-bind, alchemist et al.
# Any changes not supported by redhat-config-bind should be put
# in /etc/named.custom
#
include "/etc/named.custom";

include "/etc/rndc.key";

options {
directory "/var/named_in/";
datasize 2098;
......
};
};

#Log Files
logging {
category queries {
default_syslog;
};
};

#DataBase Files
zone "0.0.127.in-addr.arpa" {
type master;
file "0.0.127.in-addr.arpa.zone";
};
zone "10.in-addr.arpa" {
type master;
file "10.in-addr.arpa.zone";
};


zone "localhost" {
type master;
file "localhost.zone";
};
zone "xxu.edu.cn" {
type master;
file "xxu.edu.cn.zone";
};

named.out

代码:

## named.conf - configuration for bind(named.out) 
#
# Generated automatically by redhat-config-bind, alchemist et al.
# Any changes not supported by redhat-config-bind should be put
# in /etc/named.custom
#
include "/etc/named.custom";

include "/etc/rndc.key";

options {
directory "/var/named_out/";
datasize 2098;
... ...
};
# 注意这里监听的端口不一样了
listen-on port 8053 {
# 本机IP地址
10.xx.xx.xx;
};
};

#Log Files
logging {
category queries {
default_syslog;
};
};

#DataBase Files
zone "0.0.127.in-addr.arpa" {
type master;
file "0.0.127.in-addr.arpa.zone";
};
zone "xx.xx.210.in-addr.arpa" {
type master;
file "xx.xx.210.in-addr.arpa.zone";
};


zone "localhost" {
type master;
file "localhost.zone";
};
zone "xxu.edu.cn" {
type master;
file "xxu.edu.cn.zone";
};

为什么选对外发布的做重定向呢,当时的考虑是对内解析的流量大,可以减少一个环节。

然后做iptables的重定向,在iptable配置文件中添加

12下一页  GO
【内容导航】
第1页:双重dns服务器配置指南 第2页:双重dns服务器配置指南



本文评论       全部评论
发表评论
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款


点评: 字数
姓名:

L
I
N
U
X


GOOGLE搜索
Google