安装环境CENTOS 5.5

 

 

 

 

 

有待修改,不符合真正现实

 

yum安装bind



  1. #yum update
  2. #yum -y install bind* caching-nameserver
  3. [root@houchunyue ~]# rpm -qa bind*
    bind-devel-9.3.6-4.P1.el5_4.2
    bind-9.3.6-4.P1.el5_4.2
    bind-chroot-9.3.6-4.P1.el5_4.2
    bind-libs-9.3.6-4.P1.el5_4.2
    bind-utils-9.3.6-4.P1.el5_4.2
    bind-sdb-9.3.6-4.P1.el5_4.2
    bind-libbind-devel-9.3.6-4.P1.el5_4.2    #查看BIND版本,我的是9.2.4的

 

设定.conf

 


#vi   /var/named/chroot/etc/named.conf


红色字体是我加上去的。
//
// named.conf for Red Hat caching-nameserver
//

 

options {
directory “/var/named”;
dump-file “/var/named/data/cache_dump.db”;
statistics-file “/var/named/data/named_stats.txt”;
/*
* 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;
};

 

//
// a caching only nameserver config
//
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};

 

zone “.” IN {
type hint;
file “named.ca”;
};

 

zone “localdomain” IN {
type master;
file “localdomain.zone”;
allow-update { none; };
};
zone “test.com” IN {
type master;
file “test.com.zone”;
allow-update { none; };
};

 

zone “localhost” IN {
type master;
file “localhost.zone”;
allow-update { none; };
};

 

zone “0.0.127.in-addr.arpa” IN {
type master;
file “named.local”;
allow-update { none; };
};

 

zone “0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa” IN {
type master;
file “named.ip6.local”;
allow-update { none; };
};

 

zone “255.in-addr.arpa” IN {
type master;
file “named.broadcast”;
allow-update { none; };
};

 

zone “0.in-addr.arpa” IN {
type master;
file “named.zero”;
allow-update { none; };
};

 

include “/etc/rndc.key”;

 

添加zone文件

 

# cd /var/named/chroot/var/named/
# cp -p localdomain.zone test.com.zone                #加-p参数能保持文件原来的属性
# vi test.com.zone

 

TTL    86400
@               IN SOA test.com root (
42              ; serial (d. adams)
3H              ; refresh
15M             ; retry
1W              ; expiry
1D )            ; minimum
IN NS           test.com
www     IN A            192.168.84.112                          #把原来的localhost替换成你自己的域名,我这里是test.com,www是一条A记录,如果你有邮件,也可以加MX记录,保存退出。

 

这样正向查询的记录就已建好,由于我是测试,没有去建反向查询的zone文件,原理是一样的。

 

启动并将其加入系统自动服务列表。

 




  1. # service named start
  2. # chkconfig named on

 

在我建好的时候,碰到这样的问题

 

Rndc: Couldn’t find server ‘localhost’: Name or service not known

 

解决方法:

 

1 修改/etc/rndc.conf
options {

 

default-key “rndc-key”;

 

default-server 127.0.0.1; #这里改成了IP地址,原来是localhost

 

default-port 953;

 

};

 

2 在文件/etc/hosts 里加上

 

127.0.0.1               localhost.localdomain localhost

 

主/次 dns無法覆寫

 

/var/named 權限  修改成named:named

 

chown named:named /var/named

文章標籤
全站熱搜
創作者介紹
創作者 ........... 的頭像
...........

..........

........... 發表在 痞客邦 留言(0) 人氣(4)