DNS域名服务器配置
========================DNS域名服务器=====================
1)bind安装:
yum -y install bind*
.................
Downloading Packages:
---------------------------------------------------------------------------------------------------------------
Total 116 MB/s | 4.4 MB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : bind-devel 1/5
Installing : bind 2/5
Installing : bind-chroot 3/5
Installing : bind-sdb 4/5
Installing : bind-libbind-devel 5/5
Installed:
bind.i386 30:9.3.6-4.P1.el5_4.2 bind-chroot.i386 30:9.3.6-4.P1.el5_4.2
bind-devel.i386 30:9.3.6-4.P1.el5_4.2 bind-libbind-devel.i386 30:9.3.6-4.P1.el5_4.2
bind-sdb.i386 30:9.3.6-4.P1.el5_4.2
Complete!
yum -y install caching-nameserver*
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 61 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : caching-nameserver 1/1
Installed:
caching-nameserver.i386 30:9.3.6-4.P1.el5_4.2
Complete!
2)配置
操作主目录:
/var/named/chroot
a、访问控制文件 /var/named/chroot/etc
/var/named/chroot/etc/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";
// 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";#主区域配置文件 就是当前目录下的 named.rfc1912.zones
};
===================================================
b、主区域配置文件 /var/named/chroot/etc/named.rfc1912.zones
zone "." IN { #跟区域配置 /var/named/chroot/var/named/named.ca 包含13台根服务器的地址 AAAA表示根服务IPV6地址
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 "0.0.127.in-addr.arpa" IN { //反向解析
type master;
file "named.local";
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; };
};
c、数据解析文件 /var/named/chroot/named/var/named
a)、正向解析
==============================================
[root@localhost named]# cat localhost.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
==============================================
b)、反向解析
=================================================
[root@localhost named]# cat named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
===============================================
3)启动服务
service named restart
4)端口--->53