在RHEL4系统中搭建DNS服务器
2007-05-30 by kenthy#qingdaonews.com
#########################################################################################
系统环境:RHEL4 [ 2.6.9-5.EL ]
BIND版本:
bind-9.2.4-2
bind-utils-9.2.4-2
bind-chroot-9.2.4-2
bind-libs-9.2.4-2
目标功能:
Server1: 192.168.1.1/24
根域:.
主域:redhat.com [正反向都作]
soft.redhat.com子域授权给Server2
主域:redhat.org
转发域:全局转发至 202.106.0.20,202.106.46.151
Server2: 192.168.1.2/24
主域:soft.redhat.com
辅助域:redhat.org
转发域:全局转发至 Server1
#########################################################################################
一、安装
各软件使用RHEL4光盘中自带的rpm包安装,[步骤略]
二、配置
Server1:
1 网络参数配置
1> # vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.1
NETMASK=255.255.255.0
2> # vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=
3> # vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.1 www
192.168.1.2
4> # vi /etc/resolv.conf
nameserver 192.168.1.1
5> # hostname //可省略
# export HOSTNAME= //可省略
2 主配置文件
1> # vi /var/named/chroot/etc/named.conf
options {
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
forwarders { 202.106.0.20; 202.106.46.151; };
};
zone "." IN {
type hint;
file "named.ca";
};
zone "redhat.com" IN {
type master;
file "redhat.com.zone";
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "1.168.192.arpa";
};
zone "redhat.org" IN {
type master;
file "redhat.org.zone";
};
3 区域配置文件
1> # vi /var/named/chroot/var/named/named.ca //公共文件,细节省略
2> # vi /var/named/chroot/var/named/redhat.com.zone
$TTL 86400
@ SOA . root.. (
2007053001
3H
15M
1W
1H
)
IN NS .
www IN A 192.168.1.1
soft IN A 192.168.1.2
IN NS .
. IN A 192.168.1.2
mail IN CNAME www
3> # vi /var/named/chroot/var/named/redhat.org.zone
$TTL 86400
@ SOA . root. (
2007053001
3H
15M
1W
1H
)
IN NS 192.168.1.1
www IN A 10.10.10.1
ftp IN A 10.10.10.2
4> # vi /var/named/chroot/var/named/1.168.192.arpa
$TTL 86400
@ SOA . root.. (
2007053001
3H
15M
1W
1H
)
IN NS .
1 IN PTR .
1 IN PTR mail.redhat.com.
2 IN PTR soft.redhat.com.
Server2:
1 网络参数配置
1> # vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.2
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
2> # vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=
3> # vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.1
192.168.1.2
4> # vi /etc/resolv.conf
nameserver 192.168.1.1
5> # hostname //可省略
# export HOSTNAME= //可省略
2 主配置文件
1> # vi /var/named/chroot/etc/named.conf
options {
directory "/var/named";
forwarders { 192.168.1.1; };
};
zone "redhat.org" IN {
type slave;
file "slaves/redhat.org.zone";
};
zone "soft.redhat.com" IN {
type master;
file "soft.redhat.com.zone";
};
3 区域配置文件 [soft子区域省略,redhat.org的辅助区域文件不需手工创建]
三、启动
# chkconfig --level 2345 named on
# service named restart
四、测试
1 以Server1作为DNS服务器:
分别解析、、、、192.168.1.1
2 以Server2作为DNS服务器:
分别解析、、、
阅读(772) | 评论(0) | 转发(0) |