linux 搭建私有dns,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  .  "

;       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是无法看到的

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值