在apple app store中下載,速度有時快有時慢,因為蘋果的2000台伺服器分布在全球各地。
通過修改hosts,可以指定為速度快的IP,比如香港澳門的伺服器。
獲得速度快的IP的方法:
在ping.chinaz.com查詢網域名稱的ping值,選幾個在自己的網路中測試速度。
在PC Windows、Linux上修改hosts很容易,在獲得root許可權的Android上也可以,在iPhone、iPad上無法修改。
適用情境:
1、無法修改hosts:沒有root的Android,iOS等
2、多人修改hosts比較繁瑣,一旦IP失效,大家都要改:比如創業的Android、iOS開發組。
目的:
提高Apple app store下載速度,提高Google Play下載速度。
解決方案:
在路由器上配DNSMasq——就是把hosts改改格式,寫到路由器上即可。
DNSMasq支援泛網域名稱,比如在hosts中需要配2000條:
# apple app store202.175.5.114 a1.phobos.apple.com202.175.5.114 a2.phobos.apple.com202.175.5.114 a3.phobos.apple.com……202.175.5.114 a2000.phobos.apple.com
而DNSMasq只需要1條:
#apple app storeaddress=/.phobos.apple.com/202.175.5.114
軟硬體要求:
由於家用路由器的系統一般不支援修改DNSMasq,所以要給路由器安裝dd-wrt、openwrt等開源OS。
購買有線或無線路由器時請按照dd-wrt、openwrt的裝置支援列表購買。
dd-wrt支援列表:http://www.dd-wrt.com/wiki/index.php/Supported_Devices#TP-Link
openwrt支援列表:http://wiki.openwrt.org/toh/start#tp-link
常見的路由:
dd-wrt 支援:
TP-Link 841N(版本3.x、5.x、7.x),不支援8.x的縮水版。¥129,無線300M,有線100M。
TP-Link 941N,¥215,無線300M,有線100M。
openwrt支援:
TP-Link 1041N,¥185,無線300M,有線千兆。
操作步驟:
1、買路由器
2、到dd-wrt.com下載OS韌體,在路由器管理介面192.168.1.1中刷入OS
3、在新的dd-wrt OS管理介面192.168.1.1——〉服務——〉服務——〉“DNSMasq 附加選項”中填入下列內容——〉應用
常用服務的DNSMasq:
#Android -> Account & sync -> Add account -> Google##good, 114DNSserver=/android.clients.google.com/114.114.114.114##bad, because google CN IP no ssl#address=/android.clients.google.com/203.208.45.211##good, google USA IP#address=/android.clients.google.com/74.125.31.100#Android -> Gtalk##good, 114DNSserver=/mtalk.google.com/114.114.114.114##bad, google CN#address=/mtalk.google.com/203.208.45.211##good, google USA IP#address=/mtalk.google.com/74.125.71.188#Android -> Google Play -> installaddress=/.c.android.clients.google.com/203.208.45.211#google photo#Android -> Google Play -> app logo and screenshot#Web -> Google Playaddress=/.ggpht.com/203.208.45.211#google user content#Android -> Google+ -> user avatar and feed img#Web -> Google+ address=/.googleusercontent.com/203.208.45.211#google cn#Web -> Google dituaddress=/.google.cn/203.208.45.211address=/google.cn/203.208.45.211address=/g.cn/203.208.45.211#google static#Web -> google images searchaddress=/.gstatic.com/203.208.45.211#Web https -> google images searchaddress=/encrypted-tbn1.google.com/203.208.45.211#Web ->Google Playaddress=/play.google.com/203.208.45.211address=/apis.google.com/203.208.45.211#Web ->Gmailaddress=/clients2.google.com/203.208.45.211#Webaddress=/google.com/203.208.45.211address=/www.google.com/203.208.45.211address=/www.google.com.hk/203.208.45.211address=/accounts.google.com/203.208.45.211address=/mail.google.com/203.208.45.211address=/code.google.com/203.208.45.211address=/translate.google.com/203.208.45.211address=/translate.google.com.hk/203.208.45.211address=/docs.google.com/203.208.45.211address=/profiles.google.com/203.208.45.211address=/plus.google.com/203.208.45.211address=/picasaweb.google.com/203.208.45.211address=/news.google.com/203.208.45.211address=/ditu.google.com/203.208.45.211#apple app storeaddress=/.phobos.apple.com/202.175.5.114
參考資料:
http://code.google.com/p/dnsmasq-android-ios/
http://code.google.com/p/smarthosts/
todo:
Android Google+的介面uri未知,所以經常斷線。web版是plus.google.com很容易知道。
: