毗连拓扑:router A--155M--(port A)ATM network(port B)--155M--router B+ ]4 u8 d: Y7 q" ]+ ~& f
路由器ping自己测试环路的情形就不用说了,此刻我要说的是如不美观在没有环路的情形下,路由器ping自己的包,是否发出去呢?从显示的时延来看,比ping对端小的多,显然这个包没有发出去。这么说,路由器很聪了然--有环路的时辰,ping包就出去了;而没有环路的情形下,ping包就不出去。事实是这样吗?我先后用了两种体例来验证:1 s. S+ A0 j' ~- H$ W0 n- y
1.一边router A ping自己,一边在ATM交流机上看该pvc的流量
" G1 N3 c- J; H5 o 2.把Agilent串联在路由器和ATM交流机之间,即router A--155M--Agilent--(port A)ATM network(port B)--155M--router B,尔后decode;同时在router A上debug
% B5 |; U6 R/ _$ X+ I$ M 先说说体例一的结不美观吧,在port A和port B上,都看到了双向的流量,在router B的ATM接口上也看到了input和output流量,可是两个标的目的的流量都是不合错误等的。用port A的流量举例吧,从router A领受到的流量少,而发送给router A的流量多,这多出来的流量是什么、且从哪里来的呢?我只好采用了体例二来剖析。/ S' I4 N. |" M' o
在router A上debug ip packet detail的结不美观如下:3 x* `/ W& m% y- q6 g1 s
Router#p 10.0.0.1 repeat 1 size 36
1 H8 z) c- m) I7 R. z! o; L 段1:发出request
6 S9 v g- ^9 f, n7 s. I; M' R; \6 ` *May 18 21:29:46.626: IP: tableid=0, s=10.0.0.1 (local), d=10.0.0.1 (ATM1/0.3), routed via RIB
) Z' G; r9 a- s+ ` *May 18 21:29:46.626: IP: s=10.0.0.1 (local), d=10.0.0.1 (ATM1/0.3), len 100, sending0 ~0 I( ^; C" K# I1 _! c t
*May 18 21:29:46.626: ICMP type=8, code=0- H7 P$ Z1 \/ V {& T m. m( f) h+ B
段2:收到自己的request& X3 c6 p' B( u7 c
*May 18 21:29:46.630: IP: tableid=0, s=10.0.0.1 (ATM1/0.3), d=10.0.0.1 (ATM1/0.3), routed via RIB
* w5 }4 Z' k ?7 w! Z *May 18 21:29:46.630: IP: s=10.0.0.1 (ATM1/0.3), d=10.0.0.1 (ATM1/0.3), len 100, rcvd 3
3 N. y- E0 o; Y$ C' V3 \ *May 18 21:29:46.630: ICMP type=8, code=0
1 _5 c, T& G* p4 A4 Y7 H" |, [& | 段3:发出reply
+ F J' R3 Y5 Q! _, o/ I# Y# {( } *May 18 21:29:46.630: IP: tableid=0, s=10.0.0.1 (local), d=10.0.0.1 (ATM1/0.3), routed via RIB" @5 |* f* z4 Q: L
*May 18 21:29:46.630: IP: s=10.0.0.1 (local), d=10.0.0.1 (ATM1/0.3), len 100, sending' A* Q0 f5 B; E1 t
*May 18 21:29:46.630: ICMP type=0, code=0' [' n2 `" Y' ?: l* B
段4:收到对方的redirect, {9 {! s3 k. d
*May 18 21:29:46.630: IP: tableid=0, s=10.0.0.2 (ATM1/0.3), d=10.0.0.1 (ATM1/0.3), routed via RIB
" |' b6 v s; b( c; W2 R *May 18 21:29:46.630: IP: s=10.0.0.2 (ATM1/0.3), d=10.0.0.1 (ATM1/0.3), len 56, rcvd 3
/ g" `4 e) O' T. s$ A! P *May 18 21:29:46.630: ICMP type=5, code=16 b2 S9 ]+ h& u) _
段5:收到对方的reply* k7 c- a2 [, C( z
*May 18 21:29:46.630: IP: tableid=0, s=10.0.0.1 (ATM1/0.3), d=10.0.0.1 (ATM1/0.3), routed via RIB4 m7 p1 n9 _& j. _3 p* w2 |5 v1 i
*May 18 21:29:46.630: IP: s=10.0.0.1 (ATM1/0.3), d=10.0.0.1 (ATM1/0.3), len 100, rcvd 3
! p; b0 e2 ~2 l$ n$ z, I *May 18 21:29:46.630: ICMP type=0, code=0
$ r2 W! z; Q0 y 段6:收到对方的redirect
! U! X/ f9 ], T+ x% O* [ *May 18 21:29:46.630: IP: tableid=0, s=10.0.0.2 (ATM1/0.3), d=10.0.0.1 (ATM1/0.3), routed via RIB
/ R* v5 S& y5 H *May 18 21:29:46.630: IP: s=10.0.0.2 (ATM1/0.3), d=10.0.0.1 (ATM1/0.3), len 56, rcvd 3, b S5 @; j5 C0 D, L* d+ W% s
*May 18 21:29:46.630: ICMP type=5, code=1
8 m/ J: h7 j) V 我认为可能是系统措置的原因,使得段3和段4倒置了。因为显然是router B分袂针对router A发来的request和reply发出的redirect动静。Agilent decode的结不美观也能和以上信息相对应。
& Q1 w, g s* y 声名一下:9 o6 r# R; M/ \, b" O. t, l O+ _
ICMP type=8,code=0暗示echo request;
' C# D) c; g0 C ICMP type=0,code=0暗示echo reply;
2 L s- x3 r- e+ D' A5 [ ICMP type=5,code=1暗示redirect for host;! U( ?+ |# q# N. ?+ v6 D
router A接口的地址是10.0.0.1,router B接口的地址是10.0.0.2。只ping一个包的目的是便于剖析哪些结不美观是一堆儿的;36字节是为了能少分几个信元,这是能ping出的最小包(36字节+28字节的ICMP头),但仍是跨越了48字节,所以不得不分成了2个信元。( o) e/ I; N# a$ G$ b
所以,router B发出的redirect for host动静导致了port A发给router A的流量大于从router A收到的流量。+ S$ P& V9 X, I8 @; ]1 d* W
到这里,router A ping自己的过程已经搞清嚣张了,还剩下最后一个问题:为什么如斯这般折腾,时延会远远小于ping对端的时延?莫非路由器很只能,把中心往返折腾用去的时刻减去了?请列位谈判! H4 z9 x1 [) t5 }# G( K. g8 _
此外,我在debug的时辰还发现了此吐矣闽问题,就是如不美观debug ip icmp,就根柢看不到request,如下所示:* a* o5 q5 b2 g" g
*May 18 21:30:11.794: ICMP: echo reply sent, src 10.0.0.1, dst 10.0.0.1% ^7 P0 P; l& N7 J+ H
*May 18 21:30:11.794: ICMP: bogus redirect from 10.0.0.2 - for 10.0.0.1 use gw 10.0.0.13 Q3 t3 E- F2 u( M* W
*May 18 21:30:11.794: gateway address is class=Apple-style-span> |