相信大家都遇到过这么样的情况,客户说他的包已经发出来了,但是没有收到对方的回包,对方说我这里网络一切正常,就这么僵持着。其实有些厂商设备是可以通过ACL匹配流量,然后通过debug输出在CLI终端上,这样流量到底有没有发过来,或者说到底有没有回包,都可以清楚的看到。
下面我就分享下H3C路由器的相关配置方法。
- 首先需要明确IP会话的源目地址,这样才能通过ACL精确匹配,源目IP我用ABCD表示
acl advanced 3000
rule 0 permit ip source A 0 destination B 0
rule 5 permit ip source C 0 destination D 0
- 其次将ACL应用在流量经过的接口下
int GE1/0/1
packet-filter 3000 inbound/outbound
- 最后就是开启debug,注意要在尖括号模式下开启
debugging ip packet acl 3000
terminal debugging
The current terminal is enabled to display debugging logs.
terminal monitor
打印出的信息如下:
*Jul 17 15:52:30:706 2025 设备名IPFW/7/IPFW PACKET:-MDC=1-Slot=3;
Sending, interface = GigabitEthernet1/0/1
version = 4, headlen = 20,tos = 40
pktlen = 60,pktid = 47580,offset = 0,ttl = 51,protocol = 6
checksum = 29592,s = 源IP,d = 目的IP
channelID = 0,vpn-instanceIn = 0,vpn-instanceOut = 0
prompt: Sending IP packet received from interface GigabitEthernet1/0/1 at interface GigabitEtheret1/0/2.
Payload:TCP
source port = 源端口,destination port 目的端口
sequence num =0x5fe964a7,acknowledgement num= 0x00000000,flags = 0x2
window size = 64240,checksum = 0x0a02,header length = 40.
配置其实很简单,但是不常用到,用到的时候确实很方便。还有一点需要注意的是,如果接口不只是跑的一个客户的流量,那个在配置ACL的时候要格外谨慎,需要配置兜底条目,rule permit ip any,否则会把其他流量禁用。