BIND是一款DNS服务器产品
本次目的是搭建DNS服务,并把所有域名指向到一个IP地址,来达到限制使用此DNS用户的网上行为
首先安装CentOS5.3
安装基本开发环境包,gcc 之类的,然后修改yum源
第一步,
- # yum install -y bind bind-chroot caching-nameserver
yum安装bind服务,bind-chroot是用来保护root用户,让bind在运行时局限在chroot目录中
简单来说就是bind-chroot可以让bind认为,“/”不是“/”而是“/var/named/chroot/”
- Installed: bind.i386 30:9.3.6-16.P1.el5 bind-chroot.i386 30:9.3.6-16.P1.el5 caching-nameserver.i386 30:9.3.6-16.P1.el5
-
Updated: bind-libs.i386 30:9.3.6-16.P1.el5 bind-utils.i386 30:9.3.6-16.P1.el5
-
Complete!
yum结束后的提示,因为系统自带一些,所以会有更新
第二步,启动bind服务看看
- # service named start
-
Starting named: [ OK ]
-
看来安装没有问题
第三步,因为yum安装了caching-nameserver所以会生成一些,配置文件模板zone之类的
创建bind服务的配置文件
- # vim /var/named/chroot/etc/named.conf
-
options {
-
directory "/var/named";
-
};
-
zone "." IN {
-
type master;
-
file "test.com.zone";
-
};
第四步,创建zone文件
- # vim /var/named/chroot/var/named/test.com.zone
-
$TTL 86400
-
@ IN SOA @ root (
-
42 ; serial (d. adams)
-
3H ; refresh
-
15M ; retry
-
1W ; expiry
-
1D ) ; minimum
-
-
IN NS @
-
IN A 127.0.0.1
-
IN AAAA ::1
-
* IN A 192.168.10.24
重启bind服务
- # service named restart
-
Stopping named: [ OK ]
-
Starting named: [ OK ]
修改一下本机的DNS指向
- vim /etc/resolv.conf
-
-
; generated by /sbin/dhclient-script
-
nameserver 192.168.10.63 ->你在机的ip
测试nslookup
- nslookup
-
>
-
Server: 192.168.10.63
-
Address: 192.168.10.63#53
-
-
Name:
-
Address: 192.168.10.24
-
>
-
Server: 192.168.10.63
-
Address: 192.168.10.63#53
-
-
Name:
-
Address: 192.168.10.24
-
>
-
Server: 192.168.10.63
-
Address: 192.168.10.63#53
-
-
Name:
-
Address: 192.168.10.24
-
>
所有域名都已经指向192.168.10.24
阅读(9080) | 评论(0) | 转发(0) |