Linux(CentOS 5.4)中Bind服务的安装与配置全过程

RedHat 5系列的都差不多。本人也测试了!DNS的配置,之后会联合DNS+apache服务器配置部署出来!
[root@testserver named]# uname -a
Linux testserver 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[root@testserver CentOS]# rpm -qa | grep bind
bind-chroot-9.3.6-4.P1.el5
bind-utils-9.3.6-4.P1.el5
bind-libs-9.3.6-4.P1.el5
ypbind-1.19-12.el5
bind-9.3.6-4.P1.el5
kdebindings-3.5.4-6.el5
[root@testserver CentOS]# rpm -ivh bind-libbind-devel-9.3.6-4.P1.el5.x86_64.rpm
Preparing...                ########################################### [100%]
   1:bind-libbind-devel     ########################################### [100%]
[root@testserver CentOS]# rpm -ivh bind-devel-9.3.6-4.P1.el5.x86_64.rpm
Preparing...                ########################################### [100%]
   1:bind-devel             ########################################### [100%]
[root@testserver CentOS]# rpm -qa | grep bind
bind-chroot-9.3.6-4.P1.el5
bind-utils-9.3.6-4.P1.el5
bind-libs-9.3.6-4.P1.el5
ypbind-1.19-12.el5
bind-9.3.6-4.P1.el5
bind-libbind-devel-9.3.6-4.P1.el5
kdebindings-3.5.4-6.el5
bind-libbind-devel-9.3.6-4.P1.el5
bind-devel-9.3.6-4.P1.el5
[root@testserver CentOS]#
[root@testserver CentOS]# rpm -ivh caching-nameserver-9.3.6-4.P1.el5.x86_64.rpm
Preparing...                ########################################### [100%]
   1:caching-nameserver     ########################################### [100%]
这里有点蒙了,安装到那里去了呢?一般的配置文件都在/etc/下,当然也可以rpm -ax | grep i bind,去看看/etc/named.*
[root@testserver named]# ls -la /etc/named.*
lrwxrwxrwx 1 root named 52 Dec 17 16:50 /etc/named.caching-nameserver.conf -> /var/named/chroot//etc/named.caching-nameserver.conf
lrwxrwxrwx 1 root named 42 Dec 17 16:50 /etc/named.rfc1912.zones -> /var/named/chroot//etc/named.rfc1912.zones
看到了吗?原来这是一个 l 文件,方法有两种,你可以直接进入原目录去对原文件进行编辑,也可对链接文件操作,效果一样的!
[root@testserver CentOS]# cd /var/named/chroot/etc/
[root@testserver etc]# ls
localtime named.caching-nameserver.conf named.rfc1912.zones rndc.key
[root@testserver etc]# cd /var/named/chroot/var/named/
[root@testserver named]# ls -ld
drwxr-x--- 4 root named 4096 Dec 17 16:50 .
[root@testserver named]# ls
data              localhost.zone   named.ca         named.local slaves
localdomain.zone named.broadcast named.ip6.local named.zero
[root@testserver named]# cd ../../etc/

# pwd
/var/named/chroot/etc
# cd ../var/named/
# pwd
/var/named/chroot/var/named


[root@testserver etc]# cp -b named.rfc1912.zones named.rfc1912.zones.bak
[root@testserver etc]# ls
localtime named.caching-nameserver.conf named.rfc1912.zones named.rfc1912.zones.bak rndc.key

any;为更改后的

[root@testserver etc]# vim named.caching-nameserver.conf
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory     "/var/named";
dump-file     "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
query-source    port 53;   
query-source-v6 port 53;
allow-query     { any; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view localhost_resolver {
match-clients         { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.rfc1912.zones";
};

[root@testserver named]# cd ../../etc/
---------------------------------------------------------------------------
[root@testserver etc]# cp named.rfc1912.zones named.rfc1912.zones.bak

//定义一个正向域 linuxidc.com ,定义正向解析文件名 linuxidc.com.zone
//定义反向域 ,定义反向解析文件名 10.25.61.zone
[root@testserver etc]# vi named.rfc1912.zones
//test

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wygzwp.html