|
|
实验环境:内部局域网,通过路由器上网,一个c类地址:192.168.1/24 主机名:www.junjie.com
IP地址:192.168.1.2 路 由 器IP:192.168.1.1
要解析的域为:junjie.com
我的配置如下:
在文件/etc/hosts中
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.1.2 www.junjie.com www
在文件/etc/host.conf中
order hosts,bind
在文件/etc/resolv.conf中
search junjie.com
nameserver 192.168.1.2
在文件/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 "junjie.com" IN {
type master;
file"named.junjie.com";
allow-update{none;};
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file"named.ippd";
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; };
};
include "/etc/rndc.key";
在目录/var/named下建立正向解析文件"named.junjie.com"
$TTL 86400
@ IN SOA www.junjie.com. root.www.junjie.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS www.junjie.com.
localhost IN A 127.0.0.1
www IN A 192.168.1.2
在目录/var/named下建立反向解析文件"named.ippd"
$TTL 86400
@ IN SOA 1.168.192.in-addr.arpa. root.www.junjie.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS www.junjie.com.
2 IN PTR www.junjie.com.
可是我用nslookup检测,感觉正反向解析都不正确,不知道是何种原故,请高手能够给我指点,万分感谢! |
|