转载:ubuntu 安装 dnsmasq 解决网速慢的问题

我的系统是Ubuntu-14.04.

先安装dnsmasq,我们用它来做DNS缓存,因为ubuntu慢的原因大部分在域名解析上。

sudo apt-get install dnsmasq

然后我们编辑dnsmasq的配置文件:

sudo vi /etc/dnsmasq.conf

找到这一行,修改为
resolv-file=/etc/resolv.dnsmasq.conf

确保我们的/etc/resolv.conf里的DNS信息正确,然后执行

sudo cp /etc/resolv.conf /etc/resolv.dnsmasq.conf

然后将/etc/resolv.conf里的DNS改为127.0.0.1

nameserver 127.0.0.1

如果我们是adsl上网的话,要修改一下/etc/ppp/peers/*-provider,以免/etc/resolv.conf的内容被它覆盖。

//注释下面这句
#usepeerdns

然后我们重启dnsmasq服务。

sudo /etc/init.d/dnsmasq restart

再试试吧,效果有一定的提升。

参考资料: http://www.ubuntukylin.com/ukylin/forum.php?mod=viewthread&tid=13000
          http://blog.renhao.org/2012/05/ubuntu-12-04-add-dns-nameservers/

猜你喜欢

转载自timothy258.iteye.com/blog/2159497