DNS服务是Linux平台一个比较繁琐的服务,现配置一个简单的DNS服务,详见下文。
一、安装DNS组件
1、rpm -ivh bind*
2、rpm -ivh caching-nameserver-9.3.3-10.el5
二、复制模板配置文件,并修改配置文件
1、进入如下目录 cd /var/named/chroot/etc
2、复制模板 cp -p name.caching-nameserver.conf named.conf
3、修改全局配置文件 vim named.conf
listen-on port 53 {any;} 把127.0.0.1修改为any,表示侦听任何端口allow-query {any;} 修改为any,表示允许任何主机查询
match-clients { localhost; };
match-destinations { localhost; };
recursion yes;
zone "contoso.com"IN {
type master;
file "contoso.com.zone";
type master;
file "192.168.0.zone";
};
include "/etc/named.rfc1912.zones";
};
三 、复制正向解析模板,并修改正向解析文件
$TTL 86400
@ IN SOA localhost. root.localhost. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS localhost.
mail IN A 192.168.0.106
www IN A 192.168.0.105
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS contoso.com.
106 IN PTR mail.contoso.com.
; generated by /sbin/dhclient-script
search contoso.com
nameserver 192.168.0.106
七、测试DNS服务器
mail.contoso.com has address 192.168.0.106
106.0.168.192.in-addr.arpa domain name pointer mail.contoso.com.