linux下安装dns本地缓存
linux的版本是gentoo
写爬虫不用dns缓存很容易就
Error:6-Couldn'tresolvehost'rss.news.yahoo.com'
装一个缓存也很简单摘抄如下赞美D前辈
http://electrostorm.net/archive/2007/10/enabling-dns-cache-dnsmasq-gentoo
""""
#emerge-avdnsmasq
Theninsert'nameserver127.0.0.1'intothefirst(important!)linein/etc/resolv.conf
nameserver127.0.0.1
...
Thenstartdnsmasq
#/etc/init.d/dnsmasqstart
YoucantestyourlocalDNScachebytyping这个工具在bind-tools中
diggoogle.de
Havealookatthequerytime(mustbesomethinghigherthan50msinmostcases).Querygoogleagain.
Nowthat'samazing,isn'tit?0msec!
Letdnsmasqstartatboot(otherwiseyoucan'tresolveanyDNSnamesbecauseyou'veeditedthe/etc/resolv.conf)
#rc-updateadddnsmasqdefault
""""
~$sudodigblogbus.com
;<<>>DiG9.4.2-P2<<>>blogbus.com
;;globaloptions:printcmd
;;Gotanswer:
;;->>HEADER<<-opcode:QUERY,status:NOERROR,id:38631
;;flags:qrrdra;QUERY:1,ANSWER:1,AUTHORITY:2,ADDITIONAL:8
;;QUESTIONSECTION:
;blogbus.com.INA
;;ANSWERSECTION:
blogbus.com.3600INA210.51.44.249
;;AUTHORITYSECTION:
blogbus.com.78INNSns1.dns.com.cn.
blogbus.com.78INNSns2.dns.com.cn.
;;ADDITIONALSECTION:
ns1.dns.com.cn.667INA124.42.122.8
ns1.dns.com.cn.667INA124.42.122.9
ns1.dns.com.cn.667INA122.70.138.5
ns1.dns.com.cn.667INA122.70.138.6
ns2.dns.com.cn.2477INA124.42.122.6
ns2.dns.com.cn.2477INA122.70.138.8
ns2.dns.com.cn.2477INA122.70.138.9
ns2.dns.com.cn.2477INA124.42.122.5
;;Querytime:9msec
;;SERVER:127.0.0.1#53(127.0.0.1)
;;WHEN:SunApr1211:56:162009
;;MSGSIZErcvd:219
~$sudodigblogbus.com
;<<>>DiG9.4.2-P2<<>>blogbus.com
;;globaloptions:printcmd
;;Gotanswer:
;;->>HEADER<<-opcode:QUERY,status:NOERROR,id:2017
;;flags:qrrdra;QUERY:1,ANSWER:1,AUTHORITY:0,ADDITIONAL:0
;;QUESTIONSECTION:
;blogbus.com.INA
;;ANSWERSECTION:
blogbus.com.3597INA210.51.44.249
;;Querytime:0msec
;;SERVER:127.0.0.1#53(127.0.0.1)
;;WHEN:SunApr1211:56:192009
;;MSGSIZErcvd:45
~$sudodigrss.news.yahoo.com
;<<>>DiG9.4.2-P2<<>>rss.news.yahoo.com
;;globaloptions:printcmd
;;Gotanswer:
;;->>HEADER<<-opcode:QUERY,status:NOERROR,id:13933
;;flags:qrrdra;QUERY:1,ANSWER:3,AUTHORITY:3,ADDITIONAL:3
;;QUESTIONSECTION:
;rss.news.yahoo.com.INA
;;ANSWERSECTION:
rss.news.yahoo.com.300INCNAMEgeoycs-p.gy1.b.yahoodns.net.
geoycs-p.gy1.b.yahoodns.net.1476INCNAMEl1.ycs.glb.cn.yahoo.com.
l1.ycs.glb.cn.yahoo.com.186INA203.209.246.249
;;AUTHORITYSECTION:
glb.cn.yahoo.com.1853INNSgtm1.glb.cnh.yahoo.com.
glb.cn.yahoo.com.1853INNSgtm1.glb.cn2.yahoo.com.
glb.cn.yahoo.com.1853INNSgtm1.glb.cnb.yahoo.com.
;;ADDITIONALSECTION:
gtm1.glb.cn2.yahoo.com.6692INA202.160.176.148
gtm1.glb.cnb.yahoo.com.1651INA202.165.98.16
gtm1.glb.cnh.yahoo.com.6692INA203.209.251.160
;;Querytime:7msec
;;SERVER:127.0.0.1#53(127.0.0.1)
;;WHEN:SunApr1211:58:492009
;;MSGSIZErcvd:250
~$sudodigrss.news.yahoo.com
;<<>>DiG9.4.2-P2<<>>rss.news.yahoo.com
;;globaloptions:printcmd
;;Gotanswer:
;;->>HEADER<<-opcode:QUERY,status:NOERROR,id:32314
;;flags:qrrdra;QUERY:1,ANSWER:3,AUTHORITY:0,ADDITIONAL:0
;;QUESTIONSECTION:
;rss.news.yahoo.com.INA
;;ANSWERSECTION:
rss.news.yahoo.com.298INCNAMEgeoycs-p.gy1.b.yahoodns.net.
geoycs-p.gy1.b.yahoodns.net.1474INCNAMEl1.ycs.glb.cn.yahoo.com.
l1.ycs.glb.cn.yahoo.com.184INA203.209.246.249
;;Querytime:0msec
;;SERVER:127.0.0.1#53(127.0.0.1)
;;WHEN:SunApr1211:58:512009
;;MSGSIZErcvd:130