当前位置: 技术问答>linux和unix
请高手指导一下Linux DNS设置问题
来源: 互联网 发布时间:2015-12-12
本文导语: 我在Linux下设置DNS,可是总是不成功,老是提示我Host www.test.cn not found: 2(SERVFAIL)。我的配置文件是 named.conf为: // // a caching only nameserver config // controls { inet 127.0.0.1 allow { localhost; } keys { rndckey;...
我在Linux下设置DNS,可是总是不成功,老是提示我Host www.test.cn not found: 2(SERVFAIL)。我的配置文件是
named.conf为:
//
// 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 "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; };
};
zone "test.cn" IN {
type master;
file "test.cn.zone";
allow-update { none; };
};
include "/etc/rndc.key";
test.cn.zone为:
$TTL 1800
$ORIGIN test.cn.
@ IN SOA ns1.test.cn. root.test.cn. (
2006082700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS ns1.test.cn.
IN A 192.168.1.210
www IN A 192.168.1.210
请问哪里有问题呢???
named.conf为:
//
// 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 "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; };
};
zone "test.cn" IN {
type master;
file "test.cn.zone";
allow-update { none; };
};
include "/etc/rndc.key";
test.cn.zone为:
$TTL 1800
$ORIGIN test.cn.
@ IN SOA ns1.test.cn. root.test.cn. (
2006082700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS ns1.test.cn.
IN A 192.168.1.210
www IN A 192.168.1.210
请问哪里有问题呢???
|
改成www IN CNAME 192.168.1.210
试试
别忘了resolv.conf里设置dns服务器。
nslookup是测试dns的工具。
试试
别忘了resolv.conf里设置dns服务器。
nslookup是测试dns的工具。
|
你可以用NSLOOKUP命令试试看看能不能正向解析localhost,localdomain,反向解析127.0.0.1,如果行的话试照下面的步骤做下(aiirii兄弟教我的),如果不行的话检查你的DNS服务是否有正常启动.
bind 在自己下载源码安装,和直接选安装程序安装的配置路径有点不同,我自己也走了些弯路。
.zone, .local 文件应该放在
/var/named/chroot/var/named 目录下,
最好修改 chown named *
建立 ln -s /var/named/chroot/var/named/test.zone /var/named/test.zone
bind 在自己下载源码安装,和直接选安装程序安装的配置路径有点不同,我自己也走了些弯路。
.zone, .local 文件应该放在
/var/named/chroot/var/named 目录下,
最好修改 chown named *
建立 ln -s /var/named/chroot/var/named/test.zone /var/named/test.zone