Posts Tagged: bind


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


27
七 08

缓存DNS查询,解决DNS查询慢的问题

pdnsd, written by Thomas Moestl, is a proxy DNS server with permanent caching (the cache contents are written to hard disk on exit) that is designed to cope with unreachable or down DNS servers (for example in dial-in networking).
The official pdnsd homepage by the original author can be found at http://home.t-online.de/home/Moestl/, but unfortunately pdnsd is no longer being maintained by him. As far as I know I am presently the only one actively working on the code, so if you want the latest features and fixes, this is the place to get them.

主页:http://www.phys.uu.nl/~rombouts/pdnsd.html

配置起来非常简单:

1. 将example配置文件复制一份

2. 将:

server {
label= “myisp”;
ip = 58.215.76.163

IP换成自己的ISP提供的DNS地址,多个用”,”隔开

3. 最重要的一步,许多DNS不接受”ping”测试,所以要将:

uptest=if/ping 改成

uptest=query

4.  将/etc/resolv.con里的nemeserver改成127.0.0.1

PS:

pdnsd.conf是可以控制pdnsd的返回结果的,就是说,可以通过配置pdnsd来达到自定义解析结果的日的。

另外,我们使用pdnsd的根本原因是因为ISP的DNS不稳定,解析慢。pdnsd可以直接从根服务器查询开始,更不必依赖于ISP的DNS。但是需要说明的是,使用了CDN服务的站点,可以会取到不精确的地址,而导致访问速度不佳。