DNS


9
十二 08

域名解析慢的问题

avahi-daemon – The Avahi mDNS/DNS-SD daemon

The  Avahi  mDNS/DNS-SD daemon implementing Apple’s ZeroConf architecture (also known as “Rendezvous” or “Bonjour”). The daemon registers local IP addresses and static services using mDNS/DNS-SD and provides two IPC APIs for local programs to make  use  of  the  mDNS  record cache  the  avahi-daemon  maintains. First there is the so called “simple protocol” which is used exclusively by avahi-dnsconfd (a daemon which configures unicast DNS servers using server info published via mDNS) and nss-mdns (a libc NSS plugin, providing name resolution via mDNS). Finally there is the D-Bus interface which provides a rich object oriented interface to D-Bus enabled applications.

一同事的本本连接服务器很慢,感觉像是在做反向解析。服务器上的SSH Daemon我已经配置了UseDNS no,所以应该不是服务器端的问题。后来发现ping一个域名也很慢,加上-n参数就很快。

我们刚搬机房的时候,服务器上也发生过类似的事情。不过当时是从任何地方ping机房的服务器都会很慢。

strace了一下ping www.bsdmap.com

发现要调用avahi-daemon:
connect(4, {sa_family=AF_FILE, path=”/var/run/avahi-daemon/socket”}, 110) = 0

于是,停掉avahi-daemon服务。一切恢复正常!看来是avahi-daemon出了问题。

avahi-daemon是一个苹果电脑上的“零配置(跟网络有关)”构架的实现。个人理解像是桌面系统上东西,服务器上应该用不着。


29
八 08

DNS的SOA记录

笔记:关于DNS的SOA记录的各项含义。

以我的域名为例:

bsdmap.org    IN    SOA    ns2.xinnetdns.com.    hostmaster.xinnetdns.com. (
1083128244    ; serial number
3600                ; refresh
1800                ; retry
604800            ; expire
7200  )             ; min TTL

SOA值
序列号:格式为yyyymmddnn,nn代表这一天是第几次修改。在每次更新了你的区数据后不要忘了增加序列号的值。辅名字服务器通过比较这个序列号是否加载一份新的区数据拷贝。
refresh(刷新):告诉该区的辅名字服务器相隔多久检查该区的数据是否是最新的。
retry(重试):如果辅名字服务器超过刷新间隔时间后无法访问主服务器,那么它就开始隔一段时间重试连接一次。这个时间通常比刷新时间短,但也不一定非要这样。
expire(过期或期满):如果在期满时间内辅名字服务器还不能和主服务器连接上,辅名字服务器就使用这个我失效。这就意味着辅名字服务器将停止关于该区的回答,因为这些区数据太旧了,没有用了。设置时间要比刷新和重试时间长很多,以周为单位是较合理的。
否定缓存TTL(生存期):这个值对来自这个区的权威名字服务器的否定响应都适用。
新版的bind的时间设置灵活了很多,以前只接收以秒为单位(一周有608400秒)。现在可以用h(小时),d(天),w(周)表示。
RFC1537建议顶级名字服务器采用以下值:
refresh        24h
retry              2h
expire         30d
否定缓存ttl     4d

参考:http://www.ripe.net/docs/ripe-203.html