1.大家最关注的,翻墙,防止DNS被劫持。2 n! @3 H! ^6 k+ V }; B3 j, {
资深不资深的玩家肯定都知道某墙的事情。用了OpenDNS之类后,真的能防止被某墙劫持域名吗?恐怕太小看某墙了吧。只要是DNS的UDP包经过旁路设备,直接就会被篡改。不信?看看结果
6 ^1 A% |2 Y5 m% y6 W( {7 Q正常请求一个被劫持的域名,当然是劫持没商量了
0 e4 v; P" ^# l4 S# C( N; m" e7 t" v" B% G3 x% k0 `+ |
Sam@Bra:~$ dig hen.bao.li
; m; M, a: T$ n: J; <<>> DiG 9.6.0-APPLE-P2 <<>> hen.bao.li# r& E$ N9 N; K: c# u- K
;; global options: +cmd
8 K( ^5 v* X1 i2 e;; Got answer:
5 @ |. j4 v W n* b. }, `;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50859
; U2 L- M* o4 I& D. u0 Y;; flags: qr rd ra% f& v8 h; g5 q$ l/ U6 j, y- h
; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 06 l, u3 d$ H' H/ h8 Y
;; QUESTION SECTION: ;hen.bao.li. IN A
6 X, X+ f1 z7 H1 R) R y;; ANSWER SECTION: hen.bao.li. 85697 IN A 78.16.49.157 ~* r& {# R3 u/ {8 M
;; Query time: 0 msec
- c0 W2 X0 s6 r( v;; SERVER: 127.0.0.1#53(127.0.0.1)
$ P; Z+ y6 @2 v+ e0 Z# i;; WHEN: Mon Dec 7 23:18:48 2009
) L r3 }" |* y: H, y4 K% [;; MSG SIZE rcvd: 44- k+ H/ ?6 g q7 w
?# t1 j) G8 K5 c5 G, x, c- V0 S" pSam@Bra:~$ dig hen.bao.li
* j5 h* D" r& D1 r; <<>> DiG 9.6.0-APPLE-P2 <<>> hen.bao.li
% j1 z) U: D8 P7 I9 u;; global options: +cmd
5 q- c& |$ i" s+ H* y% E6 l;; Got answer:$ I! Y) o1 ~6 l+ K' `4 y
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50859# B0 ^, p* \/ E0 \6 i6 _, f' t
;; flags: qr rd ra
8 ?/ j7 ]* y+ ^8 j y y; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0, ^: ~% i3 P- }! w
;; QUESTION SECTION:/ n3 B. N3 j# Z; c' H! x
;hen.bao.li. IN A
+ O" ?, H+ M" b/ t;; ANSWER SECTION:5 L2 T7 ^3 }. ? ?/ t) M# L
hen.bao.li. 85697 IN A 78.16.49.15
/ U: \" M5 }3 {$ ~6 [' A;; Query time: 0 msec
2 A# G1 a. `# p2 m; \, |3 L; {;; SERVER: 127.0.0.1#53(127.0.0.1)) w; d/ k) U6 I% a9 m! E, P
;; WHEN: Mon Dec 7 23:18:48 2009
u% P. R5 X# q+ \5 j/ Z/ g4 A" [2 r;; MSG SIZE rcvd: 44( j. ?5 ^6 b! A, U
# ]: D, o# V8 X( B
然后再看用了Google Public DNS后,照样劫持你没商量: g$ i3 [% {2 z7 R! M% U! U' h
# Y3 N& D# D/ n! f9 k' o4 R. I
Sam@Bra:~$ dig @8.8.8.8 hen.bao.li3 I% C- |0 n% ` h
; <<>> DiG 9.6.0-APPLE-P2 <<>> @8.8.8.8 hen.bao.li5 M y: \& {3 k. I7 V7 D- y
; (1 server found)7 \- S$ v; L; T3 F
;; global options: +cmd
; l6 c2 p y. S: x;; Got answer:
3 q0 h7 c1 w2 ^% b;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15485
0 x: S7 \& w, V;; flags: qr aa rd ra
! @. E% P5 W9 o6 x; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0( Y) n N$ u) H5 \. h0 B" y
;; QUESTION SECTION: ;hen.bao.li. IN A
6 \4 B6 Z. z- W% ]8 C1 f1 l;; ANSWER SECTION: hen.bao.li. 86400 IN A 78.16.49.15: J, F; m/ _0 u
;; Query time: 75 msec$ J/ w1 ? R- ? [- ` ?1 F4 j$ B6 U
;; SERVER: 8.8.8.8#53(8.8.8.8)
{# B, u) Y3 V. [ r! `- f7 H6 G" H;; WHEN: Mon Dec 7 23:20:58 2009
7 Q4 X1 m$ i \$ T! I+ V; v8 ];; MSG SIZE rcvd: 54& \7 S" a! C# g
. `$ b- N; a, s我们看看国外机器得出的真实结果! L5 k, z9 r" D# P; f( e- s e
6 k1 ?& ?7 J! U. U9 F+ G[root@WS-10267 ~]# dig @8.8.8.8 hen.bao.li: p: x$ C% g' i- T, `2 J
; <<>> DiG 9.3.4-P1 <<>> @8.8.8.8 hen.bao.li
& ^ \) P' _# r8 Y7 g( x; (1 server found)
w+ p+ S* X8 D5 i- R+ {6 B9 I;; global options: printcmd6 d" @6 Z( \1 \! Z9 U- c4 t7 }
;; Got answer:
+ U% v8 s- w$ }6 c, J9 o8 o8 P;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20845
0 ?- _! z$ |2 K6 n, v' _;; flags: qr rd ra1 X% L$ N! x# _6 W' i! h/ j$ Q
; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
2 Z; Q3 j& t G6 z- `;; QUESTION SECTION: ;hen.bao.li. IN A
9 G5 U! Q) Z8 |# D, O;; ANSWER SECTION: hen.bao.li. 14400 IN A 69.163.142.44- x. h$ [0 i+ X: P6 _, [
;; Query time: 252 msec
& N9 R4 Y6 [: J, Z;; SERVER: 8.8.8.8#53(8.8.8.8)
& f7 d. q8 a [- e( i9 n;; WHEN: Mon Dec 7 23:25:12 2009
: Z& e% l& Q& C7 E;; MSG SIZE rcvd: 44' y+ o0 ?% B/ g/ H3 [
+ B/ t E$ E; w9 P可以看到,此路不通。想靠换国外DNS来翻墙的可以醒醒了。
2 g2 v5 ?. A" b- K- K- ^/ H; H5 q7 u% E% _% u+ q+ G4 r1 A4 m# s; N# y
2.解析速度快
$ i* L" B- Q8 s9 `) N
% N+ C# k# F( K+ ~% HGoogle Public DNS解析速度是挺快的,但OpenDNS就未必了
- V! L" {, k* j2 B8 m5 ]
- O: g0 W6 B9 E8 H. z, H' `Sam@Bra:~$ dig @208.67.222.222 http://www.dnspod.com
3 L. q* P' ~9 o4 p* d: U- R; <<>> DiG 9.6.0-APPLE-P2 <<>> @208.67.222.222 http://www.dnspod.com
8 a! k. |. u7 Y( G, p: t6 R% a; (1 server found)
% z0 f+ R* O( P0 T;; global options: +cmd
' x5 E. o0 E; {5 w;; Got answer:
' ?0 _" a$ ]% Q8 B' I% g5 @;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17404 x0 g4 T3 u( p# V
;; flags: qr rd ra9 v |- x/ x3 j' a* w- B
; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
% @$ A. u& L' i: M3 ^$ c;; QUESTION SECTION: ;www.dnspod.com. IN A
! \# p$ V0 J5 L( a" _0 M;; ANSWER SECTION: http://www.dnspod.com. 600 IN CNAME http://www.dnspod.com.cdnudns.com. http://www.dnspod.com.cdnudns.com. 300 IN A 61.172.249.96 http://www.dnspod.com.cdnudns.com. 300 IN A 218.244.147.137) r9 ?$ S4 T: M: V
;; Query time: 608 msec: B) O! U* W2 e) H
;; SERVER: 208.67.222.222#53(208.67.222.222)- t; F9 P) a: c- j) _# c
;; WHEN: Mon Dec 7 23:29:01 2009
$ h8 f* o, G- ?) A5 R: t( \;; MSG SIZE rcvd: 101
, v) G- h. d d3 K0 F v: s! R8 x7 y9 }7 x+ E
3.最重要的问题,访问网站真的快吗?
" Z1 Z5 ?( b3 S7 U3 s
0 K! n2 {& Y- Q. a! [' t* K相信不少人一定记得之前QQ用户出现过一次“免费出国”,当然,现在这个情况也会出现在用了OpenDNS和Google Public DNS用户的身上。
3 c- p! W5 j" C; `2 b9 a8 m4 C) |3 I
大家都知道中国特色的互联网,南北分家,互访速度巨慢无比,网站的维护人员绞尽脑汁的想办法解决互联互通的问题,加速大家的网站访问速度。
! M+ [5 O5 O6 n8 N, t- N+ u
# ]( U$ Y& }: U5 q; L网站加速访问有好几种办法,有钱的大公司就用BGP AnyCast,但并不是人人都做得起(有自己的IP段,做一次BGP广播X-XX万,要达到最佳访问效果必须要做N次BGP广播,最后费用有可能达到 XXX万)。没钱的公司就只能用智能DNS了,包括自建的DNS,或者直接用DNSPod这样的现成方案,其实原理都一样。1 h3 c$ L' ?: \& O# i" L
( g" l% Q2 ~( b智能DNS其实并不是太智能,它靠的预先分配好几个区域,然后根据用户请求的IP来判断用户属于哪个区域,之后返回对应区域的服务器IP。正常情况下,用户在国内上网,用的是ISP自动分配的DNS,用户域名解析请求发给ISP的DNS,ISP的DNS又发给DNSPod这样的域名授权DNS。 DNSPod这时候拿到的IP地址基本是ISP的DNS地址,所以很方便的就能判断出用户所在的区域,并把结果返回给用户。
8 f; I& A0 D% r% g) O( Q6 j
5 u/ G; a0 x% `3 c但如果这个时候,用户用的是OpenDNS或者Google Public DNS,因为这些服务器的IP地址是在国外,并且N多老外都在用,智能DNS就不好判断该怎么返回了。返回国外的IP,影响国内用户的访问速度。0 j1 y% M3 G! G! b
0 i0 @7 i: B6 D! w' V+ n _
如果返回国内的IP,影响到其他老外的访问速度。并且如果返回国内的IP,那么该到底返回电信还是网通的IP呢?用户属于哪个省份?无从判断。那么最后只能人多决定人少,返回国外的服务器IP。3 P& t) z8 e7 |& W+ }$ X. d- |
2 [; f2 D* d0 c: D返回国外IP的结果是,用户被指向网站在国外的服务器,访问网站巨慢。7 w4 l9 c; u. n- A* ]5 J6 X
; C* V) |7 S1 |0 F本来想找几个典型例子的,但找了一圈回来,发现国内的大公司在这上面烧钱可是一点都不心痛,全部是BGP。要么就是不搭理国外用户,没针对国外用户单独进行解析,一概解析到电信的服务器去。
% \3 r* Y+ F( h4 S1 s9 v: T! w5 b+ M2 u) q+ x- Y; V
拿Google来当例子吧。我是网通用户,使用网通自带的DNS,解析www.google.com得到以下结果
, y4 s, h E8 o8 |
2 ]2 x! I2 i2 ^# w* j5 V4 MSam@Bra:~$ dig http://www.google.com" R5 U* W; @# [! B4 |: A! i/ _
......
$ U; [! E+ i) \" q9 E;; ANSWER SECTION:8 g9 ^& [) [# h) ?: l+ z9 h+ v
http://www.google.com. 48102 IN CNAME http://www.l.google.com.5 Y |; z) k' A K
http://www.l.google.com. 300 IN A 216.239.61.1042 f. U, @$ s- |$ G% Z
8 ]6 c- m$ M1 D: v
如果我用了OpenDNS的话,那么我得到下面的结果/ n0 a3 z* ]9 L) `
" G0 m# S( r5 q0 ~' ^5 K9 |0 L8 cSam@Bra:~$ dig @208.67.222.222 http://www.google.com
7 D% N, B- z6 c" T" q) H......
+ t4 H2 Q- N2 b& T v+ a7 o;; ANSWER SECTION:2 y& r1 b5 Y8 B8 @; W
http://www.google.com. 30 IN CNAME google.navigation.opendns.com.2 y) X! m9 q! p3 V: ?
google.navigation.opendns.com. 30 IN A 208.67.219.230
2 ~( l. s" W, r1 pgoogle.navigation.opendns.com. 30 IN A 208.67.219.2310 V4 D K( y' ~4 K7 l8 ~
* R5 @, v, C: p
ping一下得出的IP地址,看看速度,其实并不快
: R6 h% Z- F8 H9 j* Z, i* B6 J7 G+ }7 C) E/ [& j9 P8 ^
Sam@Bra:~$ ping 208.67.219.230 PING 208.67.219.230 (208.67.219.230): 56 data bytes
( { ~' z* _, G+ t64 bytes from 208.67.219.230: icmp_seq=0 ttl=51 time=213.828 ms
Z. t- J( `6 r# ?: v1 U64 bytes from 208.67.219.230: icmp_seq=1 ttl=51 time=213.779 ms
( l% B& }: o0 f2 T64 bytes from 208.67.219.230: icmp_seq=2 ttl=51 time=214.716 ms9 e2 N' T' ?8 \+ e
^C5 `% n3 k. m- r
--- 208.67.219.230 ping statistics ---
+ I8 F% |- T0 N4 b- U3 packets transmitted, 3 packets received, 0.0% packet loss6 M- `# O- V/ |& C+ j
round-trip min/avg/max/stddev = 213.779/214.108/214.716/0.431 ms
. q/ z; N; Z" u4 I" J) o
_. _0 h2 `0 O1 \. z# Z( v8 v我们可以再看看kaixin001.com的,如果我是网通用户,用了OpenDNS或者Google Public DNS,那么我会被解析到kaixin001的电信IP去。当然,kaixin001的电信机房线路很好,网通用户访问其实影响不大。
& b6 @2 D! u! y5 {4 o* y! @1 _% T% E# ~6 V+ [( U
我网通DNS直接解析
& j$ r' |" y) N7 j( Z1 g0 j. l
8 \' _& N* f$ Q. a% dSam@Bra:~$ dig kaixin001.com0 r! l% k- C6 U4 ?2 ^: _% R
......
6 p, @9 v/ x% o, I;; ANSWER SECTION:# O9 L2 t+ i. i' e* Z: e( i
kaixin001.com. 120 IN A 220.181.100.31
2 T6 D& q9 z" d% `" mkaixin001.com. 120 IN A 220.181.100.32
) j/ O" E; S8 h5 H1 }: ykaixin001.com. 120 IN A 220.181.100.33, Y; o2 z" H) c; j+ Y
kaixin001.com. 120 IN A 220.181.100.34
' Q; P7 b: e- \ y: fkaixin001.com. 120 IN A 220.181.100.35
) d( r3 A- [ d6 [( c8 _kaixin001.com. 120 IN A 220.181.100.30' w1 x" R8 W* e1 C1 a& O* D
5 q+ }. c5 I+ {- c! o如果我换用了OpenDNS,我得到的是kaixin001在电信服务器的IP
; ^3 S: [1 M f) J5 S- {. B/ \8 H A' s" r
Sam@Bra:~$ dig @208.67.222.222 kaixin001.com ......
0 P6 ?0 i$ Y! K" g;; ANSWER SECTION:
' j* i7 l7 w/ Q1 |. C3 c$ p5 Bkaixin001.com. 60 IN A 123.125.58.247" U! B* V( q* \: j" u
kaixin001.com. 60 IN A 123.125.56.246
4 T# @: {$ Z% [. u$ y% _8 d: Q7 @kaixin001.com. 60 IN A 123.125.56.247
+ p. S6 c3 u* ^- `! Rkaixin001.com. 60 IN A 123.125.56.245
5 N8 s0 c( n7 a' C! R8 z( ykaixin001.com. 60 IN A 123.125.56.248
/ q- }6 ]1 [2 r2 h3 i# _kaixin001.com. 60 IN A 123.125.59.20$ i d5 c/ c! w$ R* p
kaixin001.com. 60 IN A 123.125.59.16; e* f' _3 ?' |) S/ q% t- e
kaixin001.com. 60 IN A 123.125.58.248$ c6 F2 C, n$ s% I0 d# s* n2 { X
kaixin001.com. 60 IN A 123.125.58.246
* m. W" w2 ` r4 r$ bkaixin001.com. 60 IN A 123.125.58.245
, D" f; f$ v. j7 G2 E* W; `
( p: L$ `0 U3 ?7 z中小网站就没这么幸运了。中小网站没有太多的钱去买昂贵的BGP线路,只能用很低廉的智能DNS方案,比如我们经常去找字幕的射手网$ F: w. p, B0 \0 r& u
) ]0 D+ ], |& ^3 g网通直接查询,可以得到网通服务器的IP
* l- i0 J a: P# [$ V
8 @5 I( c6 K; xSam@Bra:~$ dig shooter.cn ......" Z! S! s/ k' j, J, _, Z9 ~5 d
;; ANSWER SECTION:
4 J$ X7 K- _0 i# |shooter.cn. 800 IN A 218.21.130.42
( u- C% x" g( z( k0 W, B0 C- b N
网通套用OpenDNS进行查询,得到的是射手在国外服务器的IP
5 c2 q: H6 R7 {: b9 b% E
0 W& O1 O5 F! t/ n, Z. V" J$ PSam@Bra:~$ dig @208.67.222.222 shooter.cn ......
; c0 `. y3 O6 H [4 f' T;; ANSWER SECTION:$ {. F2 A: J. [3 p1 K" g9 F
shooter.cn. 750 IN A 74.207.252.170
3 t$ [% d% x" t/ k+ O1 o9 }
- K" U2 ~) }# p9 `! g/ S这样,你就“被出国”了。用了OpenDNS或者Google Public DNS后,你访问的将是一个速度并不快的射手网。, _; u8 p: s( U6 ^' J4 m, y5 I
% I6 g' j- b) o, d3 a9 s. I国内类似射手网这样的中小网站有几十万甚至上百万,不少游戏运营商也采用这样的方案。虽然他们不一定有国外的服务器,但如果你被解析到并不属于自己网络的服务器上,访问速度或多或少都会受到影响。所以,如果你最近访问网站速度有所下降,或者玩游戏的时候经常掉线,那么你就该把DNS给换回来了。 |