注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 利用IPSec实现网络安全之..
 帮助

DNS安装手记


2007-12-24 07:28:52
 标签:安装 网络 DNS   [推送到技术圈]

版权声明:原创作品,如需转载,请与作者联系。否则将追究法律责任。
安装前请确定你的OpenSSL被更新到最新版本,某则会有警告信息。
下载地址:
wget http://www.bind.com/pub/bind9/9.4.2/bind-9.4.2.tar.gz
下载到/root/
cd /usr/local/src
tar -zvxf /root/bind*
cd bind*
./configure --prefix=/usr/local/bind9 --mandir=/usr/local/share/man –enable-threads(如果你想关闭OpenSSL的警告信息可以使用--disable-openssl-version-check)
make
make install
在/etc/rc.d/rc.local中加入/usr/local/bind9/sbin/named以便能够在开机的时候启动named
mkdir /usr/local/named/namedb
cd /usr/local/named/
sbin/rndc-confgen > rndc.conf
**************************************************************************************************************************

/*
 * log option
 */
logging {
    channel default_syslog { syslog local2; severity error; };
    channel audit_log { file "/var/log/named.log"; severity error; print-time yes; };
    category default { default_syslog; };
    category general { default_syslog; };
    category security { audit_log; default_syslog; };
    category config { default_syslog; };
    category resolver { audit_log; };
    category xfer-in { audit_log; };
    category xfer-out { audit_log; };
    category notify { audit_log; };
    category client { audit_log; };
    category network { audit_log; };
    category update { audit_log; };
    category queries { audit_log; };
    category lame-servers { audit_log; };
};

options {
    directory "/var/named";
// If you've got a DNS server around at your upstream provider, enter
// its IP address here, and enable the line below.  This will make you
// benefit from its cache, thus reduce overall DNS traffic in the Internet.
    forwarders {
        202.105.21.217;
        202.106.0.20;
        202.106.46.151;
     };
    /*
     * If there is a firewall between you and nameservers you want
     * to talk to, you might need to uncomment the query-source
     * directive below.  Previous versions of BIND always asked
     * questions using port 53, but BIND 8.1 uses an unprivileged
     * port by default.
     */
    // query-source address * port 53;
    /*
     * If running in a sandbox, you may have to specify a different
     * location for the dumpfile.
     */
    dump-file "/var/named/data/cache_dump.db";
};
// Setting up secondaries is way easier and the rough picture for this
// is explained below.
//
// If you enable a local name server, don't forget to enter 127.0.0.1
// into your /etc/resolv.conf so this server will be queried first.
// Also, make sure to enable it in /etc/rc.conf.
// Setting up secondaries is way easier and the rough picture for this
// is explained below.
//
// If you enable a local name server, don't forget to enter 127.0.0.1
// into your /etc/resolv.conf so this server will be queried first.
// Also, make sure to enable it in /etc/rc.conf.
zone "." {
    type hint;
    file "named.root";
};
zone "0.0.127.IN-ADDR.ARPA" {
    type master;
    file "localhost.rev";
};
zone "sys520084.oicp.net" {
    type    master;
    file    "zone.sys520084.oicp.net ";
};
zone "1.168.192.in-addr.arpa" {
    type    master;
    file    "zone.192.168.1";
};
**************************************************************************************************************************
zone.192.168.1
**************************************************************************************************************************

;    From: @(#)localhost.rev    5.1 (Berkeley) 6/30/90
; $FreeBSD: src/etc/namedb/PROTO.localhost.rev,v 1.6 2000/01/10 15:31:40 peter Exp $
;
; This file is automatically edited by the `make-localhost' script in
; the /etc/namedb directory.
;
@    IN    SOA    ns.sys520084.oicp.net. root.sys520084.oicp.net.(
                2005030116; Serial
                3600    ; Refresh
                900    ; Retry
                3600000    ; Expire
                3600 )    ; Minimum
    IN    NS    ns.sys520084.oicp.net
;
59    IN    PTR        ns.sys520084.oicp.net.
10    IN    PTR        winxp.sys520084.oicp.com.
58    IN    PTR        mail.sys520084.oicp.com.
 
*************************************************************************************************************************
zone.sys520084.oicp.net
*************************************************************************************************************************
;    From: @(#)localhost.rev    5.1 (Berkeley) 6/30/90
; $FreeBSD: src/etc/namedb/PROTO.localhost.rev,v 1.6 2000/01/10 15:31:40 peter Exp $
;
; This file is automatically edited by the `make-localhost' script in
; the /etc/namedb directory.
;
@    IN    SOA    ns.sys520084.oicp.net. root.sys520084.oicp.net.com.(
                2005030116; Serial
                3600    ; Refresh
                900    ; Retry
                3600000    ; Expire
                3600 )    ; Minimum
    IN    NS    ns.sys520084.oicp.net
    IN    MX10  mail
;
ns        IN    A    192.168.1.59
winxp     IN    A    192.168.1.10
mail      IN    A    192.168.1.58
**************************************************************************************************************************
name.root
ftp://rs.internic.net/domain/named.root
如果是管理DNS服务器的同志最好写个脚本更新这个东东。^_^
localhost.rev
z***************************************************************************
$TTL    600
@ IN SOA localhost. root.localhost. ( 2006102001 28800 14400 720000 86400 )
;
@          IN   NS   localhost.
1          IN   PTR  localhost.
****************************************************************************
0.0.127.IN-ADDR.ARPA
$TTL    600
@ IN SOA localhost. root.localhost. ( 2006102001 28800 14400 720000 86400 )
;
@          IN   NS   localhost.
1          IN   PTR  localhost.
*****************************************************************************
注意:
1)如果是以YUM安装的兄弟请您在yum install bind 的同时加一个bind-chroot。
2)不管你是贴的还是自己动手写的,请配置完成后运行named -g 遇到错误照着提示信息改即可。
3)如果想实现DNS负载均衡的话加几条A记录即可,如果想实现主从,请参阅鸟哥
4)抱歉熬了一通宵翻译nagios,胃实在是疼的厉害,故草草完成这篇文档,如有错误还望原谅,小弟我睡一觉立马起来修改,(深深的鞠躬)
5)^_^祝大家圣诞快乐^_^

本文出自 “sys520084home” 博客,转载请与作者联系!





    文章评论
 
2007-12-24 10:06:00
哈哈 写的不错 圣诞快乐

 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: