找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4085|回复: 3

[基础] 用Bind源码构建企业Dns缓存服务器

[复制链接]
发表于 2011-2-24 09:27:29 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
用Bind源码构建企业Dns缓存服务器。

安装Bind

#tar –zxvf bind-9.2.1.tar.gz
#cd bind-9.2.1
#./configure
#make
#make install

这种编译源码的安装方式是不会自动创建named.conf和工作目录的,要手工创建。

#mkdir /var/named

运行/usr/local/sbin/rndc-confgen获得rndc-key,利用生成的信息建立/etc/rndc.conf
内容如下:
# Start of rndc.conf
key "rndc-key" {
        algorithm hmac-md5;
        secret "t+QqnfoI33qrpXZR/EvIYw==";
};

options {
        default-key "rndc-key";
        default-server 127.0.0.1;
        default-port 953;
};
# End of rndc.conf

# Use with the following in named.conf, adjusting the allow list as needed:
# key "rndc-key" {
#       algorithm hmac-md5;
#       secret "t+QqnfoI33qrpXZR/EvIYw==";
# };
#
# controls {
#       inet 127.0.0.1 port 953
#               allow { 127.0.0.1; } keys { "rndc-key"; };
# };
# End of named.conf

建立Bind的主配置文件/etc/named.conf
内容如下:
options {
        directory "/var/named";
        forwarders { 202.96.134.133;202.96.128.68; };
};
zone "." IN {
        type hint;
        file "named.root";
};
key "rndc-key" {
        algorithm hmac-md5;
        secret "t+QqnfoI33qrpXZR/EvIYw==";
};
controls {
        inet 127.0.0.1 port 953
        allow { 127.0.0.1; } keys { "rndc-key"; };
};

建立/var/named/named.root文件,它包含了根服务器的IP地址。由于该文件是一个不断更新的文件,建议读者从Internet上下载一个最新的版本.其内容如下所示:
3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107
3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
3600000 NS E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
3600000 NS G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 198.41.0.10
3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
3600000 NS L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12
3600000 NS M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33

到些,bind已经可以工作了.修改/etc/rc.d/rc.local
增加一行.
/usr/sbin/named

重启一下.linux 
reboot
这样就可以把内网的dns指向安装有bind这台机器了.

评分

参与人数 2铜板 +40 收起 理由
47771885 + 10
zooyo + 30

查看全部评分

routeros
发表于 2011-2-24 12:47:28 | 显示全部楼层
国内应为主流网站的都做了CDN,所以还是不要用 bind 做权威服务器,建议还是配置成为缓存服务器,访问网站速度要快一些,bind上配置DNS 还是用你主ISP 的DNS


vi /usr/local/bind9/etc/named.conf
options {
         forward only;            
         forwarders {
                 202.97.224.68;                  
                 202.97.224.79;        
         };
};

评分

参与人数 1铜板 +24 收起 理由
zooyo + 24

查看全部评分

routeros
回复

使用道具 举报

发表于 2013-12-20 09:41:53 | 显示全部楼层
这个真心不懂 ,求详细教程
routeros
回复

使用道具 举报

发表于 2013-12-20 19:53:55 | 显示全部楼层
wld2005 发表于 2013-12-20 09:41
这个真心不懂 ,求详细教程

http://bbs.routerclub.com/thread-70890-1-1.html

我这个也可以做个参考,主要应该自己配置一遍.
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-15 12:13 , Processed in 0.076083 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表