当有疑问时,捕获数据包

新的嵌入式包捕获特性

虽然netflow - 我最后三个帖子的主题 - 是我不断使用的工具,以便在网络流量中获取可见性,有时您需要查看完整的数据包内容。我在工作中有一句话:“在怀疑时,捕获数据包。”前几次(或者可能很少十几次)你通过使用原始数据包捕获来解决问题,它会令人困惑和耗时。当您学习和更好地了解网络基本面时,它最终会成为您最喜欢的工具之一,您将能够快速解决疯狂的问题,以否则将留下您的头部和随机重启的事情。首先步骤在网络故障排除中使用原始数据包捕获是对基本网络的理解:OSI模型,以太网,ARP,IP,TCP / UDP等。思科的CNEN和CCNA课程在该地区具有一些良好的基本材料。我还推荐这两个经典的书籍:互联网与TCP / IPTCP / IP所示第1卷。虽然它已经过时了,但我仍然认为查尔斯斯普里顿以太网:最终指南是一个很好的参考。的列表以太网的引用在网上,也是在您学习理论的同时,您需要在读取数据包捕获方面练习实践。这几天的标准工具是Wireshark.,这是免费的。我建议获得劳拉·卡普尔的优秀新人副本铁艺书去做吧——这会为你节省很多时间,也会让你少受挫折。最后,您需要能够从网络上实际获取原始数据包。大多数人都熟悉端口镜像的概念,或者Cisco术语中的“SPAN”:一个交换机端口上的流量被复制到另一个交换机端口上,该端口上有包捕获设备(如运行Wireshark、IDS、取证设备等的PC机)。SPAN特性有几种变体:您不仅可以复制一个源端口,还可以复制一个源VLAN;您可以使用远程捕获设备(称为RSPAN)将流量复制到目的VLAN,或者在某些平台上,您甚至可以通过第三层边界(ERSPAN)隧道隧道镜像流量。SPAN是任何网络工程师必备的工具,但它也有其缺点:1)你可以很容易地订阅目标端口并丢弃数据包,2)一些配置会导致捕获重复的数据包,这可能会令人困惑,3)通过变更管理过程快速获得SPAN配置变更是一个挑战。因此,许多设计人员更喜欢使用网络轻拍或专门的矩阵开关来方便捕获。此外,SPAN特性集通常只在交换硬件平台或IOS路由器的交换模块上可用。出于这个原因,我很高兴能在IOS 12.4(20)T及以后的版本中看到嵌入式包捕获功能。有了这个特性,您可以直接从路由器上获取包捕获,并使用ACL对其进行预过滤,以获得您想要的内容。 While this isn't particularly valuable for full-time capture requirements like we find in the security world, it's extremely valuable for network troubleshooting where we just need a bit of extra visibility into what's happening at the packet level.The feature is somewhat complex, with many tuning options. We'll take a look at a basic example here. The two major configuration objects that you need to set up are the capture buffer and the capture point. The capture buffer holds the captured packets. You need to configure a name, packet size, buffer size, and typically an access-list to select only the packets that interest you. The capture point specifies the interface on which the packets will be captured, and whether they'll be captured out of the CEF path or the process-switched path. For normal data plane packets, use the CEF path. For packets that are destined to the router itself, use the process-switched path.Here's an example of a EPC configuration that will give us some routing protocol packets. This example was taken from a router running IOS 15.0(1)M. First we define the buffer:TEST#monitor capture buffer TEST_BUFFER max-size 1600The "max-size" parameter defines the number of packet bytes to be captured. For some reason, the default is 68 bytes--so unless you want just the packet headers, you'll want to set this to something at least as big as the MTU of your interface. The "size" parameter defines the size of the capture buffer itself, in kilobytes. The default in this image is 1024K; I set it to 512K here just to show an example. Finally, the "filter access-list" parameter filters the buffer based on an ACL of your choice. The next command defines the switching path, interface, and direction of the capture as a named capture point. Here's an example of what it would look like for the process-switched path:TEST#monitor capture point ip process-switched PROC_CP bothand here's an example of a CEF path capture in both directions on Fa0/0:TEST#monitor capture point ip cef CEF_CP Fa0/0 bothNext, we associate the capture point with the buffer and start the capture:TEST#monitor capture point associate PROC_CP TEST_BUFFERAfter a while we can view statistics about the buffer:TEST#sh monitor capture buffer all parametersWhen we think we have the traffic we need, we stop the capture and export the buffer as a .pcap file, for viewing inWireshark.:测试#监视器捕获点停止别不仓,目前没有办法解码CLI的数据包内容。您所能做的就是通过“Show Monitor Capture Buffer”命令获得一些基本信息,或者您可以使用“转储”参数获得原始的十六进制转储:18:03:05.339 UTC 2010年4月26日:IPv4 Les CEF:FA0 /0没有18:03:03:09.355 UTC 2010年4月26日:IPv4 LES CEF:FA0 / 0 NALER4#SH监视器Capture Buffer Test_Buffer Dump494EA8F0:01005E00 ..在理论上,我认为应该可以编写TCL脚本来解析内容捕获缓冲区更为人类可读的东西,但这是我的脚本技能水平。也许我们在观众中有一些进取的程序员?尽管要求将捕获缓冲区导出用于离线查看,但我已经发现这是一个在相对较短的时间内的宝贵工具。我期待着我所有生产路由器都运行具有EPC功能集的代码的日期。

测试#监视器Capture Buffer Test_Buffer大小512

测试#监视器捕获缓冲区过滤器访问列表my_special_traffic

测试#监视器捕获点开始proc_cp

捕获缓冲区test_buffer(线性缓冲区)

缓冲区大小:524288字节,最大元素大小:1024字节,数据包:218

允许-NTH-PAK:0,持续时间:0(秒),最大数据包:0,PPS:0

相关捕获点:

名称:proc_cp,状态:活动

配置:

监视器捕获缓冲区Test_Buffer尺寸512 MAX大小1024

监视器捕获点关联PROC_CP TEST_BUFFER

测试#监视器Capture Buffer Test_Buffer导出TFTP://10.77.18.101/testbuf.pcap

* 4月22日:06:37.435:%bufcap-6-disable:捕获点proc_cp禁用。

测试#监视器Capture Buffer Test_Buffer导出TFTP://10.30.18.101/testBuf.pcap

!!

测试#

R4#SH监视器Capture Buffer Test_Buffer

18:03:04.563 UTC Apr 26 2010: IPv4 LES CEF: Fa0/0无

18:03:04.563 UTC Apr 26 2010: IPv4 LES CEF: Fa0/0无

494EA900:000A000F 8F08DAD7 080045C0 003C0000 ...... ZW..E @。<..

494ea910: 00000158 cd980a01 0107e000 000a0205…xm ..... ' .....

494EA920: EECB0000 00000000 00000000 00000000 nK..............

494EA930:00010001 000C0100 0100000000 0004 ................

494EA940:00080C04 010200 .......

我会参加落基山IPv6峰会本周晚些时候,所以在偶然的机会上,任何读者都会出现,一定要看看我!

加入网络世界社区有个足球雷竞技appFacebooklinkedin对自己最关心的话题发表评论。
有关的:

版权所有©2010.Raybet2

2021年IT薪资调查:结果是