|
好久没有装BIND了,今天要刚好要用上,于是就复习了一下,
整理一些思路,以供同好参考。
从ftp.bupt.edu.cn上找来了,(这个站点很多东西哦,而且速度很快,还是教育网的,不出国~^_^):
bind-9.2.0rc1.tar.gz
named.root
将找到的素材都下到/tmp中,然后准备开始
#cd tmp
# tar zxvf bind-9.2.0rc1.tar.gz
# cd bind-9.2.0rc1
#./configure --prefix=/usr/local/named
#make && make install
#mkdir /usr/local/named/etc
#mkdir /usr/local/named/var
#cp named.root /usr/local/named/etc
#cd /usr/local/named
#sbin/rndc-confgen > etc/rndc.conf
#cd etctail -n10 rndc.conf | head -n9 | sed -e s/#\ //g >> named.conf
#vi etc/named.conf
我的内容如下,你可以按照你的内容改写:
-----------------------------------------------------
options{
directory "/var/namedb";
pid-file "named.pid";
};
zone "." {
type hint;
file "named.root";
notify no;
};
zone "0.0.127.in-addr.arpa" {
type master;
file "localhost.rev";
notify no;
};
#定义一个正向主区域
zone "xxx.edu.cn" {
type master;
file "xxx.edu.cn.zone";
notify no;
};
#定义一个方向主区域;
zone "209.119.202.in-addr.arpa" {
type master;
file "db.202.119.209";
notify no;
};
-----------------------------------------------------
保存,然后退出VI
#mkdir /var/namedb
#touch localhost.rev xxx.edu.cn.zone db.202.119.209
三个文件的内容分别是:
localhost.rev
-----------------------------------------------------
$TTL 3600
@ IN SOA dns.xxx.edu.cn. root.xxx.edu.cn. (
2003052001 ;serial
3600;refresh
900;retry
360000;expire
3600);miminume
IN NS dns.xxx.edu.cn.
1 IN PTR localhost.
xxx.edu.cn.zone
-----------------------------------------------------
$TTL 3600
@ IN SOA dns.xxx.edu.cn. root.xxx.edu.cn. (
2003052001 ;serial
3600;refresh
900;retry
360000;expire
3600);miminume
IN NS dns.xxx.edu.cn.
dns IN A 202.119.209.98
mail IN CNAME dns
www IN A 202.119.209.99
db.202.119.209
-----------------------------------------------------
$TTL 3600
@ IN SOA dns.xxx.edu.cn. root.xxx.edu.cn. (
2003052001 ;serial
3600;refresh
900;retry
360000;expire
3600);miminume
IN NS dns.xxx.edu.cn.
98 IN PTR dns.xxx.edu.cn.
99 IN PTR www.xxx.edu.cn.
启动服务!
#named -gc /usr/local/named/etc/named.conf &
May 21 04:45:06.577 starting BIND 9.2.0rc1 -gc /usr/local/etc/named.conf
May 21 04:45:06.577 using 1 CPU
May 21 04:45:06.585 loading configuration from '/usr/local/etc/named.conf'
May 21 04:45:06.586 /usr/local/etc/named.conf:9: option 'notify' is not allowed in 'hint' zone '.'
May 21 04:45:06.621 no IPv6 interfaces found
May 21 04:45:06.622 listening on IPv4 interface lo, 127.0.0.1#53
May 21 04:45:06.623 listening on IPv4 interface eth0, 202.119.209.98#53
May 21 04:45:06.632 command channel listening on 127.0.0.1#953
May 21 04:45:06.633 ignoring config file logging statement due to -g option
May 21 04:45:06.637 zone 0.0.127.in-addr.arpa/IN: loaded serial 2003052001
May 21 04:45:06.641 zone 209.119.202.in-addr.arpa/IN: loaded serial 2003052001
May 21 04:45:06.644 zone xxx.nic/IN: loaded serial 2003052001
May 21 04:45:06.645 running
看到启动的的信息了么?
使用rndc管理
#rndc status
number of zones: 5
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
server is up and running
#vi /etc/resolve.conf
nameserver 202.119.209.98
就可以看到提示server is up and running,如果没有以外的话那么就OK了
用nslookup或dig试试看,什么?你不会用nslookup?man 一下吧~
bind的基本安装和配置其实比较简单,但是在书写配置文件和ZONE文件的时候却要格外的留心,
一个空格都足以使你的配置是错误的,我一开始的时候就是因为将
@ IN SOA dns.xxx.edu.cn. root.xxx.edu.cn. 写成了
@ IN SOA dns.xxx.edu.cn. root.xxx.edu.cn.
^^^^^^^^(多了个条格符)使得服务不正常,类似这样的小错误很多,但是很多指南中都没有提到
往往是要我们付出血和累之后才能总结出来T.T
写完了,也天亮了~~今天在机房过了个通宵~
|
|