原创 centos 5.2 下 dns 安装
1、安装软件
yum install -y bind*
yum install -y system-config-bind
yum install -y caching-nameserver
2、配置 named.conf 文件
cd /var/named/chroot/etc
[root@server etc]# ls
localtime named.caching-nameserver.conf named.conf named.rfc1912.zones rndc.key
cp -p named.caching-nameserver.conf named.conf
chmod 777 named.conf
vim named.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";
// Those options should be used carefully because they disable port
// randomization
// query-source port 53;
// query-source-v6 port 53;
allow-query { any; };
allow-query-cache { 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";
};
3、配置 named.rfc1912.zones
在 named.rfc1912.zones 文件最下面添加
zone "frank.com" IN {
type master;
file "frank.com.zone";
allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "0.168.192.zone";
allow-update { none; };
};
4、配置 frank.com.zone
cd /var/named/chroot/var/named
[root@server named]# ls
0.168.192.zone frank.com.zone localhost.zone named.ca named.local slaves
data localdomain.zone named.broadcast named.ip6.local named.zero
cp -p localhost.zone frank.com.zone
[root@server named]# cat frank.com.zone
$TTL 86400
@ IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS @
IN A 127.0.0.1
IN AAAA ::1
www IN A 192.168.0.2
mail IN A 192.168.0.2
ftp IN A 192.168.0.2
5、配置 0.168.192.zone
cp -p named.local 0.168.192.zone
[root@server named]# cat 0.168.192.zone
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
2 IN PTR www.frank.com.
2 IN PTR mail.frank.com.
2 IN PTR ftp.frank.com.
6、设置硬链接到 /var/named 目录下
ln frank.com.zone /var/named
ln 0.168.192.zone /var/named
7、设置 resolv.conf
[root@server named]# cat /etc/resolv.conf
# MADE-BY-RP-PPPOE
nameserver 192.168.0.2
nameserver 202.96.134.133
8、测试
service named restart
[root@server named]# nslookup www.frank.com
Server: 192.168.0.2
Address: 192.168.0.2#53
Name: www.frank.com
Address: 192.168.0.2
成功!