Redhat AS4.0 DNS服务器配置

1、  检验dns是否安装
# rpm �Cqa |grep bind
# rpm �Cqa |grep caching-nameserver
   
2、 DNS 3 个主要的配置文件 :
l         /etc/named.conf
l         /var/named/chroot/var/named/ 正向区域文件
l         /var/named/chroot/var/named/ 反向区域文件
 
假设创建一个 DNS 服务器,域名为 yxr.com ,主机名为 redhat DNS 服务器 IP 地址为 192.168.100.1 ,网络为 192.168.100.1/24 。同时创建正向和反向查找区域,正向解析区域为 yxr.com.zone ,反向区域文件为 100.168.192.in-addr.arpa.zone 。下面是 3 个主要配置文件的配置(更改部分均为突出颜色显示):
 
配置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 192.168.100.1 allow { localhost; } keys { rndckey; };
};
 
zone "." IN {
    type hint;
    file "named.ca";
};
 
zone "localdomain" IN {
    type master;
    file "localdomain.zone";
    allow-update { none; };
};
 
zone "localhost" IN {
    type master;
    file "localhost.zone";
    allow-update { none; };
};
 
zone "yxr.com" IN{
    type master;
    file "yxr.com.zone";
    allow-update { none; };
};
 
zone " 100.168.192 .in-addr.arpa" IN {
    type master;
    file " 100.168.192.in-addr.arpa.zone ";
    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";
 
创建并配置 yxr.com.zone 正向解析文件 $TTL    86400
@       IN SOA  redhat.yxr.com.   root.yxr.com. (
                2009100101 ; serial (d. adams )
                28800      ; refresh
                 14400       ; retry
                3600000    ; expiry
                86400 )    ; minimum
 
@          IN NS         redhat.yxr.com.
redhat    IN A        192.168.100.1
www       IN A        192.168.100.1
mail      IN CNAME    redhat.yxr.com.
yxr.com.  IN MX 10    mail.yxr.com.
 
创建并配置 100.168.192.in-addr.arpa.zone 反向解析文件
$TTL    86400
@       IN SOA  redhat.yxr.com. root.yxr.com. (
                2009100101 ; serial (d. adams )
                28800      ; refresh
                 14400       ; retry
                3600000    ; expiry
                86400 )    ; minimum
 
@         IN NS       redhat.yxr.com.
1         IN PTR      redhat.yxr.com.
1         IN PTR      www.yxr.com.
1         IN PTR      redhat.yxr.com.
 
 
3、 除了需要对以上 3 个配置文件进行配置外,在 DNS 服务器上还需要同时进行如下配置。
(1)       设置 IP 地址
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
   
# service network restart
 
(2)       DNS 客户端设置
# vi /etc/resolv.conf
   
(3)       添加主机记录
 
 
4、 启动DNS 服务
# service named start
然后通过
# tail /var/log/messages
查看日志文件提示信息
 
 
在客户端上使用 nslookup 进行测试:
 
测试成功,表示 DNS 正向和反向均正常解析
 

本文出自 “Ericyao51” 博客,转载请与作者联系!

你可能感兴趣的:(redhat,服务器,配置,dns,休闲)