迷糊妖

永不停止追寻前进的脚步
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

centos6下安装配置DNS(bind)

Posted on 2013-03-28 11:41  迷糊妖  阅读(581)  评论(0编辑  收藏  举报

 1、安装bind及相关

[root@h1 ~]# yum install bind bind-chroot 
[root@h1 ~]# yum install bind*

验证

[root@h1 ~]# rpm -q bind
bind-9.8.2-0.10.rc1.el6_3.6.x86_64
[root@h1 ~]# rpm -q bind-chroot
bind-chroot-9.8.2-0.10.rc1.el6_3.6.x86_64

2、备份hosts文件

[root@h1 ~]# mv /etc/hosts /etc/host_bak

3、修改/etc/named.conf文件

listen-on port 53
allow-query
两行为any

4、修改/etc/named.rfc1912.zones文件,添加黑色部分

5、创建rose.com.zone和137.168.192.in-addr.zone文件

[root@h1 etc]# cd /var/named
[root@h1 named]# ls
chroot  data  dynamic  named.ca  named.empty  named.localhost  named.loopback  slaves
[root@h1 named]# cp -p named.localhost rose.com.zone
[root@h1 named]# cp -p named.localhost 137.168.192.in-addr.zone
[root@h1 named]# ll
total 40
-rw-r----- 1 root  named  152 Jun 21  2007 137.168.192.in-addr.zone
drwxr-x--- 6 root  named 4096 Feb  5 10:43 chroot
drwxrwx--- 2 named named 4096 Feb  5 10:47 data
drwxrwx--- 2 named named 4096 Feb  5 15:47 dynamic
-rw-r----- 1 root  named 1892 Feb 18  2008 named.ca
-rw-r----- 1 root  named  152 Dec 15  2009 named.empty
-rw-r----- 1 root  named  152 Jun 21  2007 named.localhost
-rw-r----- 1 root  named  168 Dec 15  2009 named.loopback
-rw-r----- 1 root  named  152 Jun 21  2007 rose.com.zone
drwxrwx--- 2 named named 4096 Dec  7 04:49 slaves

[root@h1 named]# vi rose.com.zone
[root@h1 named]# vi 137.168.192.in-addr.zone

 

6、修改/etc/resolv.conf文件如下

[root@h1 etc]# cat resolv.conf
# Generated by NetworkManager
nameserver 192.168.137.2

7、验证

[root@h1 named]# service named restart
Stopping named:                                            [  OK  ]
Starting named:                                            [  OK  ]

[root@h1 named]# nslookup
> h1.rose.com
Server:                192.168.137.2
Address:        192.168.137.2#53

Name:        h1.rose.com
Address: 192.168.137.2
> h2.rose.com
Server:                192.168.137.2
Address:        192.168.137.2#53

Name:        h2.rose.com
Address: 192.168.137.3
> h3.rose.com
Server:                192.168.137.2
Address:        192.168.137.2#53

Name:        h3.rose.com
Address: 192.168.137.4

注:由于系统中关掉了防火墙,所以本次安装忽略端口。