对于ubuntu上网页慢(网页打开速度慢),图片难加载问题一直是个头疼的事。今天终于解决了
可直接把我的配置文件靠过去,放在指定位子(/etc/*);
简化步骤:
window请直接看第三条《火狐浏览器自身加速》,linux四条全部看
一、安装dns缓存:安装sudo apt-get install dnsmasq(window可以省略dns安装和配置)
二、配置dns服务(window可以省略dns安装和配置)
总共用到四个文件 resolv.conf dnsmasq.conf resolv.dnsmasp.conf dnsmasq.hosts;系统无此4文件自行创建或拷贝我,将这些文件都放在/etc/目录下
(重启电脑)
三、火狐浏览器自身加速(window,linux通用)
在火狐浏览器中添加插件fasterfox插件("附加组件")
如果图片无法显示,或加载图片很慢但加载文字类的很快,那么这种方法很好
去除"阻止弹出窗口(B)"的构:"编辑" ==> "首选项" ==> "阻止弹出窗口(B)" ==>
四、四个文件内容
1、resolv.conf(本文件可改可不改,因为计算机重启又会自动恢复成原来的内容)
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.1.1 nameserver 127.0.0.1 nameserver 218.30.19.50 nameserver 61.134.1.5 search router
2、dnsmasq.conf
#Update:2012-9-6 by Harley resolv-file=/etc/resolv.dnsmasp.conf #在这个文件指定上溯DNS地址 #no-hosts addn-hosts=/etc/dnsmasq.hosts #listen-address=127.0.0.1 strict-order cache-size=32768 #DD-WRT和OpenWRT请使用8192 log-queries #log-facility=/var/log/dnsmasq.log server=/android.clients.google.com/8.8.8.8 server=/mtalk.google.com/8.8.8.8 server=/talk.google.com/8.8.8.8 server=/reader.googleusercontent.com/8.8.8.8 server=/talkx.l.google.com/8.8.8.8 server=/profiles.google.com/8.8.8.8 server=/developer.android.com/8.8.8.8 server=/mobilemaps.clients.google.com/8.8.8.8 #Google Map Offline download #server=/weibo.com/your ISP dns here #server=/sina.com/your ISP dns here #server=/sina.com.cn/your ISP dns here #server=/sina.cn/your ISP dns here #server=/sinajs.cn/your ISP dns here #server=/sinaimg.cn/your ISP dns here #server=/taobaocdn.com/your ISP dns here #server=/alicdn.com/your ISP dns here #server=/tbcdn.cn/your ISP dns here #server=/alisoft.com/your ISP dns here #server=/tmall.com/your ISP dns here #server=/163.com/your ISP dns here #server=/qq.com/your ISP dns here #server=/taobao.com/your ISP dns here #server=/tbcdn.com/your ISP dns here ## Google Address Start ## address=/google.cn/203.208.46.161 address=/google.com/203.208.46.161 address=/google.com.hk/203.208.46.161 address=/googlehosted.com/203.208.46.161 address=/android.com/203.208.46.161 address=/google-analytics.com/203.208.46.161 address=/gstatic.com/203.208.46.175 address=/youtube.com/203.208.46.161 address=/ytimg.com/203.208.46.161 address=/google.com.hk/203.208.46.161 address=/ggpht.com/203.208.46.161 address=/googleusercontent.com/203.208.46.234 address=/appspot.com/203.208.46.161 address=/googlevideo.com/203.208.46.161 address=/googlecode.com/203.208.46.161 address=/gvt0.cn/203.208.46.161 address=/gvt0.com/203.208.46.161 address=/googleapis.com/203.208.46.161 address=/appspot.com/203.208.46.161 address=/gmail.com/203.208.46.161 #address=/top100.cn/203.208.46.161 address=/keyhole.com/203.208.46.161 address=/goo.gl/203.208.46.161 address=/g.co/203.208.46.161 address=/blogspot.com/203.208.46.161 address=/googlesyndication.com/203.208.46.161 address=/googleadservices.com/203.208.46.161 address=/google-analytics.com/203.208.46.161 ## Google Address End ## #apple services address=/phobos.apple.com/203.78.36.40 address=/adcdownload.apple.com/203.78.36.40 address=/deimos3.apple.com/203.78.36.40 address=/developer.apple.com/203.78.36.40 address=/appldnld.apple.com/203.78.36.40 address=/swcdn.apple.com/203.78.36.40 ## Twitter Address Start ## address=/t.co/199.59.149.243 address=/userstream.twitter.com/199.59.148.139 address=/twitter.com/199.59.150.10 address=/platform.twitter.com/184.29.36.124 address=/platform0.twitter.com/219.76.10.138 address=/twimg.com/184.169.75.33 address=/help.twitter.com/199.59.148.206 address=/support.twitter.com/199.59.148.206 address=/betastream.twitter.com/199.59.148.138 address=/tinypic.com/209.17.70.143 address=/bitly.com/69.58.188.34 address=/yfrog.com/208.94.0.61 address=/api.mobilepicture.com/208.87.33.151 ## Twitter Address End ## #Dropbox services #address=/dropbox.com/199.47.217.179 #address=/www.dropbox.com/199.47.216.170 #address=/wiki.dropbox.com/174.36.51.42 ## Wikimedia Address Start ## address=/wikipedia.org/208.80.152.201 address=/wikibooks.org/208.80.152.204 address=/wikinews.org/208.80.152.206 address=/wikiquote.org/208.80.152.201 address=/wikimediafoundation.org/208.80.152.201 address=/mediawiki.org/208.80.152.201 ## Wikimedia Address End ## ## Facebook Address Start ## address=/upload.facebook.com/69.63.180.51 address=/ssl.facebook.com/69.63.181.15 address=/2mdn.net/203.208.46.161 address=/facebook.com/66.220.149.25 address=/fbcdn.com/69.63.189.17 address=/fbcdn.net/61.213.189.113 address=/graph.facebook.com/66.220.149.25 address=/m.facebook.com/69.171.229.32 address=/fbcdn-profile-a.akamaihd.net/64.213.102.26 ## Facebook Address End ## ## flickr Address Start ## address=/static.flickr.com/68.142.214.43 address=/farm1.static.flickr.com/66.196.118.49 address=/farm2.static.flickr.com/69.147.90.159 address=/farm3.static.flickr.com/76.13.18.78 address=/farm4.static.flickr.com/67.195.19.66 address=/farm5.static.flickr.com/76.13.18.79 address=/farm6.static.flickr.com/98.139.197.254 address=/farm7.static.flickr.com/98.139.102.46 address=/flickr.com/66.94.233.186 address=/geo.yahoo.com/98.136.43.76 address=/l.yimg.com/68.142.250.161 address=/s.yimg.com/96.6.93.227 address=/d.yimg.com/98.137.88.88 address=/c5.ah.yahoo.com/68.142.196.57 address=/sa.edit.yahoo.com/124.108.120.124 address=/row.bc.yahoo.com/76.13.6.132 address=/open.login.yahoo.com/66.163.168.247 address=/login.yahoo.com/209.191.92.114 address=/edit.yahoo.com/209.191.92.115 address=/up.flickr.com/209.191.121.31 address=/adjax.flickr.yahoo.com/209.191.105.102 address=/content.yieldmanager.edgesuite.net/204.0.5.35 address=/us.bc.yahoo.com/76.13.6.132 address=/us.js2.yimg.com/204.0.5.34 ## flickr Address End ## ## ADs Block Start ## address=/360.cn/127.0.0.1 address=/360safe.com/127.0.0.1 address=/958167.com/127.0.0.1 address=/cpro.baidu.com/127.0.0.1 address=/decideinteractive.com/127.0.0.1 address=/double-click.net/127.0.0.1 address=/doubleclick.net/127.0.0.1 address=/googleadservices.com/127.0.0.1 address=/googlesyndication.com/127.0.0.1 address=/proxycap.com/127.0.0.1 address=/qihoo.com/127.0.0.1 address=/qihoo.net/127.0.0.1 address=/qihu.com/127.0.0.1 address=/r-tt.com/127.0.0.1 address=/r-undelete.com/127.0.0.1 address=/proimg.163.com/127.0.0.1 address=/proimg.163.com/127.0.0.1 address=/cimg1.163.com/127.0.0.1 address=/c1img3.163.com/127.0.0.1 address=/adimg.163.com/127.0.0.1 address=/ads8.com/127.0.0.1 address=/pro.163.com/127.0.0.1 address=/cm.p4p.cn.yahoo.com/127.0.0.1 address=/ liftdna.com/127.0.0.1 address=/p.mm.cn.yahoo.com/127.0.0.1 address=/new.ete.cn/127.0.0.1 address=/aliunion.cn.yahoo.com/127.0.0.1 address=/vodone.com/127.0.0.1 address=/cnzz.com/127.0.0.1 address=/img2.126.net/127.0.0.1 address=/analytics.163.com/127.0.0.1 address=/cpro.baidu.com/127.0.0.1 address=/hm.baidu.com/127.0.0.1 address=/ad_headerbanner/127.0.0.1 address=/ad_thread/127.0.0.1 address=/d3.sina.com.cn/127.0.0.1 address=/ad.cmfu.com/127.0.0.1 address=/allyes.com/127.0.0.1 address=/alimama.com/127.0.0.1 address=/alimama.cn/127.0.0.1 address=/allyes.cn/127.0.0.1 address=/view.mediav.com/127.0.0.1 address=/pagead2.googlesyndication.com/127.0.0.1 address=/eu.10jqka.com.cn/127.0.0.1 address=/p2p.qianqian.com/127.0.0.1 address=/olime.baidu.com/127.0.0.1 ## ADs Block End ## ## Anti DNS Hijack Start ## bogus-nxdomain=218.85.148.250 bogus-nxdomain=218.85.65.150 bogus-nxdomain=61.131.89.148 bogus-nxdomain=222.77.14.77 bogus-nxdomain=59.37.71.85 bogus-nxdomain=59.37.71.86 bogus-nxdomain=59.37.71.87 bogus-nxdomain=59.37.71.88 bogus-nxdomain=61.140.3.66 ## Anti DNS Hijack End ##
3、dnsmasq.hosts
#Googl Plus START 203.208.45.206 plus.google.com 203.208.45.206 plus.url.google.com 203.208.45.206 plusone.google.com #Googl Plus END #Dropbox START 199.47.217.179 dropbox.com 199.47.216.170 www.dropbox.com #107.20.207.62 dl.dropbox.com #107.20.207.62 dl-web.dropbox.com 174.36.51.42 forums.dropbox.com 174.36.51.42 wiki.dropbox.com #Dropbox END #Adobe Activation START 0.0.0.0 3dns-2.adobe.com 0.0.0.0 3dns-3.adobe.com 0.0.0.0 activate.adobe.com 0.0.0.0 activate-sea.adobe.com 0.0.0.0 activate-sjc0.adobe.com 0.0.0.0 adobe-dns.adobe.com 0.0.0.0 adobe-dns-2.adobe.com 0.0.0.0 adobe-dns-3.adobe.com 0.0.0.0 ereg.adobe.com 0.0.0.0 hl2rcv.adobe.com 0.0.0.0 practivate.adobe.com 0.0.0.0 wip3.adobe.com 0.0.0.0 activate.wip3.adobe.com 0.0.0.0 ereg.wip3.adobe.com 0.0.0.0 wwis-dubc1-vip60.adobe.com #Adobe Activation END #Facebook Start 69.171.228.25 0.facebook.com 69.171.239.10 ah8.facebook.com 69.63.189.53 api-read.facebook.com 66.220.146.89 api.connect.facebook.com 69.171.225.13 api.facebook.com 69.171.229.39 apps.facebook.com 61.213.189.98 b.static.ak.facebook.com 61.213.189.120 b.static.ak.fbcdn.net 66.220.145.57 beta.facebook.com 66.220.145.63 bigzipfiles.facebook.com 61.213.189.113 creative.ak.fbcdn.net 97.65.135.139 external.ak.fbcdn.net 69.171.224.40 c.facebook.com 69.171.241.10 chat.facebook.com 66.220.144.11 chat.thefacebook.com 66.220.147.11 check4.facebook.com 69.171.228.40 check6.facebook.com 184.31.111.139 connect.facebook.net 69.171.227.19 creativeupload.facebook.com 69.171.240.99 d.facebook.com 66.220.156.33 developers.facebook.com 69.171.224.27 error.facebook.com 66.220.152.16 facebook.com 61.213.189.113 fbcdn.net 80.67.74.111 fbcdn-photos-a.akamaihd.net 64.213.102.26 fbcdn-profile-a.akamaihd.net 173.223.232.67 fbcdn-sphotos-a.akamaihd.net 69.171.239.10 glb.facebook.com 69.171.239.10 glb1.facebook.com 66.220.147.16 graph.facebook.com 69.171.228.27 groups.facebook.com 69.63.180.186 hphotos-ak-snc1.facebook.com 69.63.180.186 hphotos-ak-snc3.facebook.com 69.171.240.10 hphotos-ash4.fbcdn.net 69.63.183.180 hphotos-pao1.fbcdn.net 69.63.183.51 hphotos-sjc1.fbcdn.net 69.63.180.186 hphotos-snc1.fbcdn.net 69.63.183.3 hphotos-snc3.fbcdn.net 66.220.151.22 hphotos-snc6.fbcdn.net 69.171.227.24 hphotos-snc7.fbcdn.net 66.220.147.55 iphone.facebook.com 69.63.177.71 irc.tfbnw.net 66.220.144.43 ldap.thefacebook.com 66.220.144.49 legacymail.thefacebook.com 69.171.229.34 m.facebook.com 69.171.239.10 mx.facebook.com 69.63.190.12 o.facebook.com 69.171.227.28 orcart.facebook.com 69.63.186.26 photos-ak-ash1.facebook.com 69.63.186.24 photos-ash1.facebook.com 69.171.229.35 pixel.facebook.com 69.171.240.14 pixmail.vip.tfbnw.net 118.214.190.105 profile.ak.facebook.com 61.213.189.114 profile.ak.fbcdn.net 69.171.247.22 s-static.facebook.com 66.220.144.97 sb-dev.thefacebook.com 66.220.144.98 sb-test.thefacebook.com 66.220.144.99 sb.thefacebook.com 61.213.189.113 s-hprofile-sf2p.fbcdn.net 184.26.194.110 s-static.ak.facebook.com 23.5.157.177 s-static.ak.fbcdn.net 69.63.178.68 secure-media.facebook.com 69.63.178.67 secure-media.fbcdn.net 69.63.181.57 secure-media-sf2p.facebook.com 66.220.145.59 secure-profile.facebook.com 69.171.231.10 secure.facebook.com 69.171.239.10 spraydns.fbops.com 69.63.181.15 ssl.facebook.com 69.171.228.44 ssl.connect.facebook.com 69.63.189.76 star.facebook.com 61.213.189.98 static.ak.facebook.com 97.65.135.163 static.ak.fbcdn.net 69.171.239.10 static.facebook.com 66.220.155.43 static.thefacebook.com 66.220.147.58 touch.facebook.com 69.171.229.17 upload.facebook.com 66.220.144.41 vpn.tfbnw.net 120.29.145.50 vthumb.ak.fbcdn.net 66.220.151.31 vupload.facebook.com 69.171.225.31 www.connect.facebook.com 69.171.247.21 www.facebook.com 66.220.146.61 www.fbplugin.com #Facebook End
4、resolv.dnsmasp.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.1.1 nameserver 127.0.0.1 nameserver 218.30.19.50 nameserver 61.134.1.5 search router
下面是我参考文章,红色为更改补充部分,仅供理解过程
一、本段参考http://blog.csdn.net/zeus_9i/article/details/6432988,
1、前言
测试系统需要频繁的去ping 外网资源,基本是各大网站,在并发量大的情况下,经常出现DNS解析不成功的问题。并且,使用分析工具查看很大一部分时间是消耗在DNS 解析上面。第一次解析成功,后面相同的操作就不用再DNS上面在耗费时间。所有考虑到使用DNS缓存服务。Linux 还跟windows 有区别,好像windows下面本身就开启了DNS缓存。
2、Dnsmasq
安装sudo apt-get install dnsmasq
dnsmasq是一个 DNS缓存软件,但它同时也可以作为一个dns查询服务器,虽然不如bind等完善,但基本功能也够用了。
3、Dnsmasq 配置(resolv.conf dnsmasq.conf dnsmasq.resolv.conf dnsmasq.hosts )
配置 resolv.conf
[root@TestAgent009 ~]# vi /etc/resolv.conf
nameserver 127.0.0.1 #增加部分
nameserver 218.30.19.50 #公网DNS
nameserver 61.134.1.5 #公网DNS
配置 dnsmasq.conf
[root@TestAgent009 ~]# vi /etc/dnsmasq.conf
resolv-file=/etc/dnsmasq.resolv.conf //目前这个文件不存在,后面会说明拷贝
listen-address=127.0.0.1
addn-hosts=/etc/dnsmasq.hosts //目前这个文件不存在,后面会说明拷贝
需要修改的地方就是这三处。dnsmasq.conf 比较长,在 vi 可以使用 " / ",来查找resolv-file, listen(我的没有这个字,我没加上去)等关键字
拷贝resolv.conf, hosts
[root@TestAgent009 ~]# cp /etc/resolv.conf /etc/dnsmasq.resolv.conf
[root@TestAgent009 ~]# cp /etc/hosts /etc/dnsmasq.hosts(这里我直接用官方文件dnsmasqhosts内容)
重启dnsmasq服务
[root@TestAgent009 ~]# /etc/init.d/dnsmasq restart(没这个命令,我直接重启)
测试
第一次:
[root@TestAgent009 ~]# dig www.sina.com.cn
;; Query time: 30 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu May 19 20:12:31 2011
;; MSG SIZE rcvd: 244
再来一次:
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu May 19 20:13:32 2011
;; MSG SIZE rcvd: 130
第二方法:在火狐浏览器中添加插件fasterfox插件(附加组件)
第三方法 如果图片无法显示,或加载图片很慢但加载文字类的很快,那么这种方法很好
去除"阻止弹出窗口(B)"的构:"编辑" ==> "首选项" ==> "阻止弹出窗口(B)" ==>