Chinaunix

标题: [原创分享]路由器ATM接口ping自己 [打印本页]

作者: quxiaosong    时间: 2006-07-27 13:57
标题: [原创分享]路由器ATM接口ping自己
连接拓扑:router A--155M--(port A)ATM network(port B)--155M--router B
路由器ping自己测试环路的情况就不用说了,现在我要说的是如果在没有环路的情况下,路由器ping自己的包,是否发出去呢?从显示的时延来看,比ping对端小的多,显然这个包没有发出去。这么说,路由器很聪明了--有环路的时候,ping包就出去了;而没有环路的情况下,ping包就不出去。事实是这样吗?我先后用了两种方法来验证:

1.一边router A ping自己,一边在ATM交换机上看该pvc的流量
2.把Agilent串联在路由器和ATM交换机之间,即router A--155M--Agilent--(port A)ATM network(port B)--155M--router B,而后decode;同时在router A上debug

先说说方法一的结果吧,在port A和port B上,都看到了双向的流量,在router B的ATM接口上也看到了input和output流量,但是两个方向的流量都是不对等的。用port A的流量举例吧,从router A接收到的流量少,而发送给router A的流量多,这多出来的流量是什么、且从哪里来的呢?我只好采用了方法二来分析。

在router A上debug ip packet detail的结果如下:
Router#p 10.0.0.1 repeat 1 size 36
段1:发出request
*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
*May 18 21:29:46.626: IP: s=10.0.0.1 (local), d=10.0.0.1 (ATM1/0.3), len 100, sending
*May 18 21:29:46.626:     ICMP type=8, code=0

段2:收到自己的request
*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
*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
*May 18 21:29:46.630:     ICMP type=8, code=0

段3:发出reply
*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
*May 18 21:29:46.630: IP: s=10.0.0.1 (local), d=10.0.0.1 (ATM1/0.3), len 100, sending
*May 18 21:29:46.630:     ICMP type=0, code=0

段4:收到对方的redirect
*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
*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
*May 18 21:29:46.630:     ICMP type=5, code=1

段5:收到对方的reply
*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
*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
*May 18 21:29:46.630:     ICMP type=0, code=0

段6:收到对方的redirect
*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
*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
*May 18 21:29:46.630:     ICMP type=5, code=1

我认为可能是系统处理的原因,使得段3和段4颠倒了。因为显然是router B分别针对router A发来的request和reply发出的redirect消息。Agilent decode的结果也能和以上信息相对应。

说明一下:
ICMP type=8,code=0表示echo request;
ICMP type=0,code=0表示echo reply;
ICMP type=5,code=1表示redirect for host;

router A接口的地址是10.0.0.1,router B接口的地址是10.0.0.2。只ping一个包的目的是便于分析哪些结果是一堆儿的;36字节是为了能少分几个信元,这是能ping出的最小包(36字节+28字节的ICMP头),但还是超过了48字节,所以不得不分成了2个信元。

所以,router B发出的redirect for host消息导致了port A发给router A的流量大于从router A收到的流量。

到这里,router A ping自己的过程已经搞清楚了,还剩下最后一个问题:为什么如此这般折腾,时延会远远小于ping对端的时延?难道路由器很只能,把中间来回折腾用去的时间减去了?请各位讨论!

另外,我在debug的时候还发现了另外一个问题,就是如果debug ip icmp,就根本看不到request,如下所示:
*May 18 21:30:11.794: ICMP: echo reply sent, src 10.0.0.1, dst 10.0.0.1
*May 18 21:30:11.794: ICMP: bogus redirect from 10.0.0.2 - for 10.0.0.1 use gw 10.0.0.1
*May 18 21:30:11.794:       gateway address is one of our addresses
*May 18 21:30:11.794: ICMP: echo reply rcvd, src 10.0.0.1, dst 10.0.0.1
*May 18 21:30:11.794: ICMP: bogus redirect from 10.0.0.2 - for 10.0.0.1 use gw 10.0.0.1
*May 18 21:30:11.794:       gateway address is one of our addresses
这是为什么啊?

另外2,我debug atm packet的结果是:
*May 18 01:56:21.711: ATM1/0.3(O):
VCD:0xD VPI:0x0 VCI:0x64 DM:0x100 SAP:AAAA CTL:03 OUI:000000 TYPE:0800 Length:0x30
*May 18 01:56:21.711: 4500 0024 2652 0000 FF01 8185 0A00 0001 0A00 0001 0800 D104 02BF 0000 0000
*May 18 01:56:21.711: 0001 921A 9220
*May 18 01:56:21.711:
*May 18 01:56:21.711: ATM1/0.3(I):
VCD:0xD VPI:0x0 VCI:0x64 Type:0x0 SAP:AAAA CTL:03 OUI:000000 TYPE:0800 Length:0x30
*May 18 01:56:21.711: 4500 0024 2652 0000 FD01 8385 0A00 0001 0A00 0001 0800 D104 02BF 0000 0000
*May 18 01:56:21.711: 0001 921A 9220
*May 18 01:56:21.711:
*May 18 01:56:21.711: ATM1/0.3(I):
VCD:0xD VPI:0x0 VCI:0x64 Type:0x0 SAP:AAAA CTL:03 OUI:000000 TYPE:0800 Length:0x44
*May 18 01:56:21.711: 4500 0038 025D 0000 FE01 A665 0A00 0002 0A00 0001 0501 163A 0A00 0001 4500
*May 18 01:56:21.711: 0024 2652 0000 FE01 8185 0A00 0001 0A00 0001 0800 D104 02BF 0000
*May 18 01:56:21.711:
*May 18 01:56:21.715: ICMP: echo reply sent, src 10.0.0.1, dst 10.0.0.1
*May 18 01:56:21.715: ATM1/0.3(O):
VCD:0xD VPI:0x0 VCI:0x64 DM:0x100 SAP:AAAA CTL:03 OUI:000000 TYPE:0800 Length:0x30
*May 18 01:56:21.715: 4500 0024 2652 0000 FF01 8185 0A00 0001 0A00 0001 0000 D904 02BF 0000 0000
*May 18 01:56:21.715: 0001 921A 9220
*May 18 01:56:21.715:
*May 18 01:56:21.715: ICMP: bogus redirect from 10.0.0.2 - for 10.0.0.1 use gw 10.0.0.1
*May 18 01:56:21.715:       gateway address is one of our addresses
*May 18 01:56:21.715: ATM1/0.3(I):
VCD:0xD VPI:0x0 VCI:0x64 Type:0x0 SAP:AAAA CTL:03 OUI:000000 TYPE:0800 Length:0x30
*May 18 01:56:21.715: 4500 0024 2652 0000 FD01 8385 0A00 0001 0A00 0001 0000 D904 02BF 0000 0000
*May 18 01:56:21.715: 0001 921A 9220
*May 18 01:56:21.715:
*May 18 01:56:21.715: ATM1/0.3(I):
VCD:0xD VPI:0x0 VCI:0x64 Type:0x0 SAP:AAAA CTL:03 OUI:000000 TYPE:0800 Length:0x44
*May 18 01:56:21.715: 4500 0038 025E 0000 FE01 A664 0A00 0002 0A00 0001 0501 163A 0A00 0001 4500
*May 18 01:56:21.715: 0024 2652 0000 FE01 8185 0A00 0001 0A00 0001 0000 D904 02BF 0000
*May 18 01:56:21.715:
我前面说了,发出去的和收回来的ping包一定会分成2个信元,这个在Agilent decode能得到证实,redirect也被分成了2个信元,但是在这里,我却看不出来分信元的痕迹,各位大侠能看出来吗?

以上的现象是在cisco路由器上发现的,华为的路由器ATM接口ping包根本就不出去。
作者: supercom    时间: 2006-07-27 14:58
够细致,可以说明atm接口ping自己的包先走到了对端。至于延时:如果路径很短可能延时并非链路造成的,也有可能是其他原因
作者: secondself    时间: 2006-07-27 15:36
提示: 作者被禁止或删除 内容自动屏蔽
作者: yftty    时间: 2006-07-27 15:51
good
作者: wonderliang    时间: 2006-07-28 10:04
还用Agilent的设备,该换了。
作者: quxiaosong    时间: 2006-07-28 11:12
换成思博伦的?
作者: quxiaosong    时间: 2006-08-01 23:06
没有人提意见吗?
作者: wonderliang    时间: 2006-08-04 20:40
有人提意见,以后多写几个。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2