1确定系统环境
[root@localhost var]# uname -r
2.6.18-1.2798.fc6
[root@localhost var]# getconf WORD_BIT
32
[root@localhost var]# uname -a
Linux localhost.localdomain 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:37:32 EDT 2006 i686 i686 i386 GNU/Linux
[root@localhost var]# rpm -qa|grep bind
bind-libs-9.3.2-41.fc6
bind-utils-9.3.2-41.fc6
bind-9.3.2-41.fc6
ypbind-1.19-5
bind-chroot-9.3.2-41.fc6
2 修改resolv.conf, 添加dns服务器ip(高亮)
; generated by /sbin/dhclient-script
search localdomain
nameserver 192.168.128.128
3 修改named.caching-nameserver.conf
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
listen-on port 53 { 192.168.128.128; };
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";
query-source port 53;
query-source-v6 port 53;
allow-query { localhost; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { localhost; };
match-destinations { localhost; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
3 修改named.rfc1912.zones
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
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 "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
// resolve domain
zone "sirius.com" in {
type master;
file "name2ip.conf";
allow-update { none; };
allow-transfer { any; };
};
// resolved domain
zone "128.168.192.in-addr.arpa" {
type master;
file "ip2name.conf";
allow-update { none; };
allow-transfer { any; };
};
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; };
};
4 在/var/named/chroot/var/named目录下添加name2ip.conf和ip2name.conf两个文件。
name2ip.conf
$TTL 86400
@ IN SOA xx.sirius.com. root.xx.sirius.com. (
2000062900; serial #serial number
28800; refresh # refresh cycle, seconds
14400; retry # redo cycle
3600000; expire # ending time
86400 ); minuum # time to live
@ IN NS xx.sirius.com.
NS xx.sirius.com.
MX 10 mail.sirius.com.
localhost IN A 127.0.0.1
xx IN A 192.168.128.128
chunju IN A 192.168.1.101
hao IN A 192.168.1.100
www IN CNAME xx
ip2name.conf
$TTL 86400
@ IN SOA xx.sirius.com. root.xx.sirius.com. (
2000062900; serial #serial number
28800; refresh # refresh cycle, seconds
14400; retry # redo cycle
3600000; expire # ending time
86400 ); minuum # time to live
IN NS xx.sirius.com.
128 IN PTR xx.sirius.com.
5 测试。比较常用的就是查看日志.
more /var/log/messages|grep named
6 常用命令
service named start
service named stop
service named status
dig
小结:比fc5.0的控制文件和zone文件混合在一起,现在数据分开的方式能更好的处理控制和配置的数据信息。配置时主要查看控制文件,数据文件,正向解析和逆向解析四个文件。有问题主要通过参看日志的报错信息,其它方面的更新还没有仔细看。先把应用跑起来,有时间再仔细看看。:)