harleylg / autoddvpn

Automatically exported from code.google.com/p/autoddvpn
0 stars 0 forks source link

聊一下gmail在電信的加速方法 #28

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
很多人都離不開gmail,然而我觀察gmail從國內訪問目前有些混�
��,mail.google.com的解析結果,有些IP非常快(60-70ms),有些IP卻��
�慢(300-400ms),然而如果這些IP全部都走VPN訪問的話,那就又更
慢了。

我的觀察如下:

macbook-2:~ macbook$ nslookup mail.google.com 8.8.8.8
Server:     8.8.8.8
Address:    8.8.8.8#53

Non-authoritative answer:
mail.google.com canonical name = googlemail.l.google.com.
Name:   googlemail.l.google.com
Address: 74.125.19.83
Name:   googlemail.l.google.com
Address: 74.125.19.19
Name:   googlemail.l.google.com
Address: 74.125.19.17
Name:   googlemail.l.google.com
Address: 74.125.19.18

如果解析出來是74.125.19的網段,上海電信直連大約360ms, 
路由表是

 2  218.83.151.81 (218.83.151.81)  2.093 ms  1.630 ms  0.441 ms
 3  218.83.151.77 (218.83.151.77)  0.240 ms  0.232 ms  0.242 ms
 4  218.83.151.17 (218.83.151.17)  0.190 ms  0.133 ms  0.142 ms
 5  61.152.87.225 (61.152.87.225)  2.586 ms  4.184 ms  2.880 ms
 6  61.152.86.54 (61.152.86.54)  1.087 ms  0.731 ms  0.740 ms
 7  202.97.35.6 (202.97.35.6)  0.789 ms  0.683 ms  0.692 ms
 8  202.97.35.18 (202.97.35.18)  3.433 ms  3.080 ms  2.886 ms
 9  202.97.33.5 (202.97.33.5)  3.734 ms  3.930 ms  3.635 ms
10  * * *
11  209.85.255.80 (209.85.255.80)  39.134 ms  40.742 ms  41.321 ms
12  209.85.249.192 (209.85.249.192)  39.175 ms  39.078 ms  40.221 ms
13  209.85.255.36 (209.85.255.36)  42.968 ms  42.108 ms  42.670 ms
14  209.85.249.36 (209.85.249.36)  385.711 ms  364.109 ms  366.122 ms
15  216.239.47.185 (216.239.47.185)  458.085 ms  463.527 ms  470.881 ms
16  209.85.251.94 (209.85.251.94)  393.985 ms  392.192 ms  397.789 ms
17  nuq04s01-in-f18.1e100.net (74.125.19.18)  364.054 ms  363.118 ms  360.888 ms

在 209.85.249.36開始嚴重變慢,不知道為什麼。

同時我也觀察到mail.google.com同時也解析出74.125.153 
的IP網段,這是透過台灣中華電信DNS查詢出來的。

macbook-2:~ macbook$ nslookup mail.google.com 168.95.1.1
Server:     168.95.1.1
Address:    168.95.1.1#53

Non-authoritative answer:
mail.google.com canonical name = googlemail.l.google.com.
Name:   googlemail.l.google.com
Address: 74.125.153.18
Name:   googlemail.l.google.com
Address: 74.125.153.19
Name:   googlemail.l.google.com
Address: 74.125.153.83
Name:   googlemail.l.google.com
Address: 74.125.153.17

從whois看來的確是GOOGLE的IP

NetRange:       74.125.0.0 - 74.125.255.255
CIDR:           74.125.0.0/16
OriginAS:
NetName:        GOOGLE
NetHandle:      NET-74-125-0-0-1
Parent:         NET-74-0-0-0-0
NetType:        Direct Allocation
NameServer:     NS2.GOOGLE.COM
NameServer:     NS3.GOOGLE.COM
NameServer:     NS4.GOOGLE.COM
NameServer:     NS1.GOOGLE.COM
RegDate:        2007-03-13
Updated:        2007-05-22
Ref:            http://whois.arin.net/rest/net/NET-74-125-0-0-1

 2  218.83.151.81 (218.83.151.81)  0.430 ms  0.401 ms  0.414 ms
 3  218.83.151.73 (218.83.151.73)  0.533 ms  0.252 ms  0.214 ms
 4  218.83.151.5 (218.83.151.5)  0.238 ms  0.153 ms  0.158 ms
 5  61.152.87.229 (61.152.87.229)  0.337 ms  0.352 ms  0.365 ms
 6  61.152.86.142 (61.152.86.142)  0.930 ms  0.998 ms  0.911 ms
 7  202.97.35.158 (202.97.35.158)  0.881 ms  0.900 ms  1.010 ms
 8  202.97.34.126 (202.97.34.126)  4.874 ms  5.393 ms  5.553 ms
 9  202.97.33.5 (202.97.33.5)  3.176 ms  3.046 ms  3.357 ms
10  * * *
11  209.85.255.80 (209.85.255.80)  39.682 ms  38.267 ms  38.794 ms
12  209.85.249.195 (209.85.249.195)  40.364 ms *  40.379 ms
13  209.85.250.90 (209.85.250.90)  61.573 ms 209.85.250.86 (209.85.250.86)  
63.387 ms  62.541 ms
14  209.85.250.101 (209.85.250.101)  87.533 ms *  61.820 ms
15  72.14.233.126 (72.14.233.126)  79.638 ms  78.361 ms  71.234 ms
16  ty-in-f17.1e100.net (74.125.153.17)  62.625 ms  62.536 ms  63.103 ms

才62ms而已。

我不確定發生了什麼事情,不過顯然(上海)電信到gmail之間發�
��了狀況,造成預設的路由變慢了非常多。

各位可以親自ping這兩個IP看看差別:

74.125.19.19
74.125.153.19

如果你跟我一樣.153只有60ms 但.19有300-400ms, 
那解決方式就是強迫解析成.153, 並且不走VPN,讓它直連。

我在exroute.d/gmail裡面已經定義了74.125.153的gmail網段直連

$ grep 74.125.153 exroute.d/gmail 
74.125.153.17
74.125.153.18
74.125.153.19
74.125.153.83

使用grace mode的朋友請這樣操作

nvram set exroute_enable=1
nvram set exroute_list='gmail'
nvram commit

這樣gmail在.153的四個IP會強迫直連。

再來就是強迫gmail解析出.153的IP, 
這個可以修改dnsmasq_options,例如

address=/mail.google.com/74.125.153.17

這樣應該訪問gmail就很快了。

Original issue reported on code.google.com by pahud...@gmail.com on 18 Oct 2010 at 4:33

GoogleCodeExporter commented 9 years ago
我在北京網通測試的結果

74.125.153.19  158ms
74.125.19.19 225ms

都不算慢,但也不快就是了。

Original comment by pahud...@gmail.com on 18 Oct 2010 at 4:36

GoogleCodeExporter commented 9 years ago
上海網通
74.125.19.19  300ms
74.125.153.19  180ms

Original comment by jkgd...@gmail.com on 18 Oct 2010 at 4:48

GoogleCodeExporter commented 9 years ago
我發現電信如果用本地DNS解析mail.google.com得到的就會是74.125.1
53了,但是如果透過8.8.8.8則是74.125.19

因此也許dnsmasq_options裡面這樣比較好
server=/mail.google.com/xxx.xxx.xxx.xxx

(xxx.xxx.xxx.xxx是本地DNS IP)

看來要讓gmail更順,還得多折騰一下才行呢!

Original comment by pahud...@gmail.com on 18 Oct 2010 at 5:16

GoogleCodeExporter commented 9 years ago
74.125.153.19  99ms
74.125.19.19 389ms
北京电信通...

Original comment by masiqi on 18 Oct 2010 at 7:58

GoogleCodeExporter commented 9 years ago
@masiqi

嗯,看來.153看來是比較適合中國的gmail節點,小心不要解析��
�.19.xxx就好了

Original comment by pahud...@gmail.com on 18 Oct 2010 at 7:59

GoogleCodeExporter commented 9 years ago
不过在VPN下这俩基本上相当...如果不用VPN GMAIL看不到CALL 
PHONE的按钮...

Original comment by masiqi on 18 Oct 2010 at 2:44

GoogleCodeExporter commented 9 years ago
这个 issue 似乎放到 wiki 里更合适些。

Original comment by m...@ike.im on 8 Jan 2011 at 8:00