|
1 说明:
主机名:server.com
主机IP:192.168.38.126
要解析的域名:example.com
example.com提供的服务有www,ftp,mail,asp等
对应的IP为:
192.168.38.125 www.example.com
192.168.38.124 asp.example.com
192.168.38. 123 ftp.example.com
192.168.38. 122 game.example.com
2 测试环境
在 FC3,FC4,AS4测试通过。
3 配置文件
*********************************************************************
/etc/named.conf
//
// named.conf for Red Hat caching-nameserver
//
options {
directory "/var/named";
//dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};
//
// a caching only nameserver config
//
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
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; };
};
zone "example.com" IN {
type master;
file "name2ip.conf";
};
zone "38.168.192.in-addr.arpa" IN {
type master;
file "ip2name.conf";
};
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; };
};
include "/etc/rndc.key";
*********************************************************************
/var/named/chroot/var/named/name2ip.conf
$TTL 86400
@ IN SOA server.com. root.server.com (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
@ IN NS server.com.
server.com.
IN A 192.168.38.126
localhost. IN A 127.0.0.1
//本行可有可无
mail IN MX 10 192.168.38.126
www IN A 192.168.38.125
asp IN A 192.168.38.124
forftp IN A 192.168.38.123
game INA 192.168.38.122
ftp IN CNAME
forftp
csgame IN CNAME forgame
air IN CNAME forgame
*********************************************************************
/var/named/chroot/var/named/ip2name.conf
$TTL 86400
@ IN SOA server.com. root.server.com (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
@ IN NS server.com.
server.com.
IN A 192.168.38.126
125 IN PTR www.example.com
124 IN PTR asp.example.com
123 IN PTR ftp.example.com
122 IN PTR game.example.com
*********************************************************************
/etc/resolv.conf
domain server.com
nameserver 192.168.38.126
nameserver 202.101.115.55
*********************************************************************
hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 server.com server localhost.localdomain localhost
192.168.38.126 server.com
*********************************************************************
/etc/hosts.conf
order hosts,bind multi on |
|