Benjamin

静以修身,俭以养德,非澹薄无以明志,非宁静无以致远。
随笔 - 388, 文章 - 0, 评论 - 196, 引用 - 0
数据加载中……

linux下DNS私有根服务器的搭建

私有根是自行创建的DNS根服务器,这个根服务器属于创建者私有专用,不能象互联网上的根服务器那样为众多的网民服务。搭建私有根一般有下列原因,例如有的单位如警察或军事部门出于保密需要,必须把单位的网络和互联网物理隔离,但又不愿使用IP地址来互相访问,这样就必须使用DNS私有根才能保证域名的正常应用;还有的大型企业为了管理方便,也在企业内设置私有根解析域名,这样可以省却去公网申请域名的麻烦。
在linux平台上我们用bind来搭建这个dns服务器,这里不阐述如何安装bind,要运行bind,需要在配置文件中填写区数据和根服务器的数据,由于是根服务器,所以不需要根服务器信息,只要一个区文件就可以了。示例如下:私有根域ip地址是192.168.102.56,com子域的地址192.168.102.89
$TTL 1d
@    IN    SOA    A.root.net.hostmaster.(
                           5    ; Serial
                           900   ; Refresh
                           600   ; Retry
                           86400   ; Expire
                           3600 ) ; Negative caching TTL

;
;Zone NS records
;
@             NS     A.root.net

;
;Zone records
;
A.root.net    IN    A  192.168.102.56


com           IN    NS    sub.root.com
sub.root.com  IN    A     192.168.102.89 
;
配置文件如下:
options{
port 53;
allow-query {any;};
pid-file "named.pid";
};

view "internal" {
zone "A_ROOT" IN { type master; file "root.zone.db"; allow-update {none;}; };

};
view "external" {
zone "A_ROOT" IN { type master; file "root.zone.db"; allow-update {none;}; };
};

com域的配置文件如下:
options{
allow-query {any;};
pid-file "named.pid";
};
 

view "internal" {
zone "." IN {type master;file "named.root";};
zone "sub" IN { type master; file "sub.root.com.db"; allow-update {none;}; };

};
view "external" {
zone "." IN {type master;file "named.root";};
zone "sub" IN { type master; file "sub.root.com.db"; allow-update {none;}; };
};
区文件sub.root.com.db内容如下:$TTL 1D
@       IN      SOA      sub.root.com.hostmaster.(
   5      ; Serial
    900         ; Refresh
     600         ; Retry
   86400         ; Expire
    3600)       ; Negative Cache TTL
;


@              IN      NS      sub.root.com.
sub.root.com.  IN      A       192.168.102.89


ysm            IN      NS      temple.ysm.com.
temple.ysm     IN      A       192.168.102.47
;
ysm域是com域下一个子域,它的配置和跟服务器和com域的配置类似,named.root和com的配置一样
named.root内容如下:
;       This file holds the information on root name servers needed to
;       initialize cache of Internet domain name servers
;       (e.g. reference this file in the "cache  .  <file>"
;       configuration file of BIND domain name servers).
;
;       This file is made available by InterNIC
;       under anonymous FTP as
;           file                /domain/named.root
;           on server           FTP.INTERNIC.NET
;       -OR-                    RS.INTERNIC.NET
;
;       last update:    Dec 12, 2008
;       related version of root zone:   2008121200
;
; formerly NS.INTERNIC.NET
;
.                  3600000  IN  NS    test.root.lan.
test.root.lan.     3600000      A     192.168.102.56
; End of File

搭建好后,启动bind就可以了,不过必须抓包才能够验证,用dig trace或lookup是无法看到的


 




 

posted on 2010-12-09 21:29 Benjamin 阅读(1707) 评论(0)  编辑 收藏 引用 所属分类: linux


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理