Around emacs, linux, etc.
Ubuntu下的DNS caching
我实在受不了了……
每个请求都要到dns server上解析一下,太影响效率了……
今天找了一下 原来非常简单 就是装一个dnsmasq 原文在这儿
然后把/etc/dnsmasq.conf里面把"listen-address=127.0.0.1"写上
再去/etc/dhcp3/dhclient.conf里头把“prepend domain-name-servers 127.0.0.1;”前面的注释去掉
再到/etc/resolv.conf里头在紧接着search后面加一行"nameserver 127.0.0.1”
最后sudo /etc/init.d/dnsmasq restart一下 就ok了
偶不是dsl用户 也不是dail-up 如果你是的话 自己看吧 呵呵
The following is ONLY for dsl customers
Note: If you have a dsl connection, the following may work:
Basically, the differences are in how the “conf” files are edited and used.
Copy the /etc/resolv.conf file to /etc/resolv.dnsmasq.conf
Then, edit the /etc/dnsmasq.conf file as follows:
- Change this line if you want dns to get its upstream servers from
- somewhere other that /etc/resolv.conf
resolv-file=/etc/resolv.dnsmasq.conf
You also have to uncomment the line that says listen-address=127.0.0.1
Now, edit /etc/resolv.conf to have ONLY the following line in it:
nameserver 127.0.0.1
Next, edit /etc/ppp/peers/dsl-provider and change the line:
usepeerdns to
#usepeerdns
(that is, comment out that line)
The ppp client does not allow you to prepend the 127.0.0.1 entry to your /etc/resolv.conf file. So what we did in the above was to create a copy of your previous resolv.conf for dnsmasq to use for lookups, update the file to use a local cache, and then prevent the ppp client from overwriting the resolv.conf file the next time. Now you can restart the dnsmasq service as I explained above, and start enjoying faster name resolution.
I don’t have a dsl connection, and so all the above is to the best of my knowledge.
To those of you still on dial-up – THANK YOU for visiting my blog! (I’m too ignorant to know how to change things to get dnsmasq to work on dial-up
)
| Print article | This entry was posted by Jay Xie on 2006/12/13 at 3:35 pm, and is filed under ubuntu. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
搜狐微博
新浪微博
about 5 years ago
居然连解析的时延你都能感觉到…..
about 5 years ago
能写点好玩的吗?
about 5 years ago
ft 一个网页要产生多少次http请求阿 每次都去解析那个速度真的不是用个数量级可以描述的……