LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 826|回复: 5

[求助]我的DNS哪里配置错了?

[复制链接]
发表于 2005-5-17 22:07:43 | 显示全部楼层 |阅读模式
debian:/# named-checkzone
example.com /var/cache/bind/db.example.com
zone example.com/IN: loaded serial 2005051617
OK

debian:/# named-checkzone 192.168.1.2 /var/cache/bind/db.192.168.1
zone 192.168.1.2/IN: loaded serial 200505167
OK

debian:/# named-checkconf /var/cache/bind/db.192.168.1
/var/cache/bind/db.192.168.1:1: unknown option '$TTL'
/var/cache/bind/db.192.168.1:3: unknown option 'Serial'
/var/cache/bind/db.192.168.1:4: unknown option 'Refresh'
/var/cache/bind/db.192.168.1:5: unknown option 'Retry'
/var/cache/bind/db.192.168.1:6: unknown option 'Expire'
/var/cache/bind/db.192.168.1:7: unknown option 'Negative'
/var/cache/bind/db.192.168.1:9: unknown option '@'
/var/cache/bind/db.192.168.1:11: unexpected token near end of file

debian:/# named-checkconf /var/cache/bind/db.example.com
/var/cache/bind/db.example.com:1: unknown option '$TTL'
/var/cache/bind/db.example.com:17: unexpected token near end of file

debian:/# nslookup
> 192.168.1.2
Server:         192.168.1.2
Address:        192.168.1.2#53

2.1.168.192.in-addr.arpa        name = debian.example.com.
> example.com
Server:         192.168.1.2
Address:        192.168.1.2#53

*** Can't find example.com: No answer
> debian.example.com
Server:         192.168.1.2
Address:        192.168.1.2#53

** server can't find debian.example.com: NXDOMAIN
> exit
debian:/#

附上我的配置文件:
/var/cache/bind/db.example.com
$TTL    604800
@       IN      SOA     debian.example.com. root.debian.example.com. (
                2005051617
                28800
                7200
                2419200
                86400)

@ NS    example.com.
@ MX    10      debian.example.com.

example.com     IN      NS      debian.example.com.
localhost.example.com   IN      A       127.0.0.1
debian.example.com      IN      A       192.168.1.2
www             IN      CNAME   debian.example.com.
ftp             IN      CNAME   debian.example.com.
/var/cache/bind/db.192.168.1.2
$TTL    604800
@       IN      SOA     debian.example.com. root.debian.example.com. (
        200505167       ; Serial
        28800           ; Refresh
        7200            ; Retry
        2419200         ; Expire
        86400 )         ; Negative Cache TTL
;
@       IN      NS      debian.example.com.
2       IN      PTR     debian.example.com.

请问:我的DNS哪里写错了?
还有,我的/var/log/message里没有named的任何记录,怎么办?
 楼主| 发表于 2005-5-19 13:27:31 | 显示全部楼层
顶起来,等待有经验的兄弟帮忙解答~~~~~
回复 支持 反对

使用道具 举报

发表于 2005-5-19 17:24:56 | 显示全部楼层
Debian好办,我以前在Debian下做过最简单的dns了。

这种东西详细说没有意思,在Debian默认安装bind9的情况下,
简单的事情就是修改几处地方。域名pk.org,网段192.168.1.0/24

#tail -10 /etc/bind/named.conf.local
zone "pk.org" {
type master;
file "/var/cache/bind/db.pk.org";
};

zone "1.168.192.in-addr.arpa"{
type master;
file "/var/cache/bind/db.192.168.1";
};

#cat /var/cache/bind/db.pk.org

$TTl    38400
@ IN SOA pkdebian.pk.org. root.pkdebian.pk.org. (
                          1039102090 ; serial, todays date + todays serial #
                          10800 ; refresh, seconds
                          3600 ; retry, seconds
                          604600 ; expire, seconds
                          38400 ) ; minimum, seconds
        IN              NS      pkdebian.pk.org.
        IN              MX 10   pkdebian.pk.org.

; 域名服
pk.org.  IN NS  pkdebian.pk.org.

; 计算机名称和地址
localhost.pk.org.       IN A    127.0.0.1
pkdebian.pk.org.        IN A    192.168.1.254
pk.pk.org.                IN A        192.168.1.100

#cat /var/cache/bind/db.192.168.1
@ IN SOA pkdebian.pk.org root.pkdebian.pk.org. (
                               1039102453 ; Serial
                               10800 ; Refresh
                               3600 ; Retry
                               604800 ; Expire
                               38400 ) ; Minimum
@                              IN NS pkdebian.pk.org.
; 主机
1.168.192.in-addr.arpa. IN NS pkdebian.pk.org.
254.1.168.192.in-addr.arpa. IN PTR pkdebian.pk.org.
100.1.168.192.in-addr.arpa. IN PTR pk.pk.org.


重启bind9
#/etc/init.d/bind9 restart

#########Debian下简单测试##########
#ping -c 4 pk
PING pk.pk.org (192.168.1.100): 56 data bytes
64 bytes from 192.168.1.100: icmp_seq=0 ttl=128 time=1.0 ms
64 bytes from 192.168.1.100: icmp_seq=1 ttl=128 time=1.0 ms
64 bytes from 192.168.1.100: icmp_seq=2 ttl=128 time=1.0 ms
64 bytes from 192.168.1.100: icmp_seq=3 ttl=128 time=1.0 ms

--- pk.pk.org ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 1.0/1.0/1.0 ms

# nslookup pkdebian
Note:  nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead.  Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   pkdebian.pk.org
Address: 192.168.1.254

# nslookup pk
Note:  nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead.  Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   pk.pk.org
Address: 192.168.1.100

##############M$简单测试############
D:\>ping pkdebian

Pinging pkdebian.pk.org [192.168.1.254] with 32 bytes of data:

Reply from 192.168.1.254: bytes=32 time<1ms TTL=64
Reply from 192.168.1.254: bytes=32 time<1ms TTL=64
Reply from 192.168.1.254: bytes=32 time<1ms TTL=64
Reply from 192.168.1.254: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.1.254:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

d:\>

D:\>nslookup pk.pk.org
Server:  pkdebian.pk.org
Address:  192.168.1.254

Name:    pk.pk.org
Address:  192.168.1.100

d:\>


当然,要测试正确DNS还要修改host、hosts.conf和resolv.conf等一些小文件。
要更复杂(比如多域、子域)更安全(比如chroot-jail)的DNS除了参考和阅读howto相关
的知识别无它法,还有就是自己测试,多google:-)
比如,偶搞了个chroot DNS,用Debian默认下根本不工作,而且也无法判断它是否
就在chroot下工作,只能从源码开始编译了开始了:-)目前工作还算良好。
回复 支持 反对

使用道具 举报

发表于 2005-5-19 23:09:41 | 显示全部楼层
example.com IN NS debian.example.com.
localhost.example.com IN A 127.0.0.1
debian.example.com IN A 192.168.1.2

域名后面加“.”,try
回复 支持 反对

使用道具 举报

发表于 2005-5-20 06:13:40 | 显示全部楼层
To nothing9
named.conf列出来看看
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-20 14:12:12 | 显示全部楼层
/etc/bind/named.conf
include "/etc/bind/named.conf.options";

// prime the server with knowledge of the root servers
zone "." {
        type hint;
        file "/etc/bind/db.root";
};

zone "localhost" {
        type master;
        file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
        type master;
        file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
        type master;
        file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
        type master;
        file "/etc/bind/db.255";
};

include "/etc/bind/named.conf.local";

/etc/hosts(默认就是ipv6)
### etherconf DEBCONF AREA. DO NOT EDIT THIS AREA OR INSERT TEXT BEFORE IT.

127.0.0.1       localhost
::1             ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
ff02::3         ip6-allhosts

192.168.1.2     debian.example.com      debian

/etc/hostname
debian
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表