PowerScale:如何使用 Tcpdump 收集交换机信息
摘要: 本文介绍如何使用数据包捕获工具收集基本交换机信息。
说明
以太网网络交换机通常会广播端口信息,例如 port name开始, port description开始, system name开始, system description以及 native vlan。Cisco Discovery Protocol (CDP) 是 Cisco 交换机平台的专有技术。链路层发现协议 (LLDP) 更像是一种行业标准。
有关此主题的更多信息:
CDP - https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/cdp/configuration/15-mt/cdp-15-mt-book/nm-cdp-discover.html
LLDP - https://www.cisco.com/c/en/us/td/docs/routers/ncs4000/software/configure/guide/configurationguide/configurationguide_chapter_0111011.pdf
此信息可以帮助工程师确定节点接口可能物理连接到的交换机端口。有时,电缆可能插入错误的交换机端口,或者端口通道可能配置了不正确的物理端口。识别端口可以帮助网络工程师快速查看这些接口上配置的内容以及它们是否正确。
“注意事项/陷阱”
- 而
tcpdump命令不应在逻辑接口上运行。例如 laggX 或 vlanX,因为信息仅与物理接口相关。 - 而
tcpdump命令应仅在物理接口上运行。它们是 1G、10G、25G、40G 等 - 最好按接口对收集数据。这意味着,如果调查 mce 接口上的聚合问题,请从 mce2 收集,然后从 mce3 收集。
- 如果节点上的接口状态为“无载波”,则不会接收到良好的数据包。这应首先作为物理问题解决。
- 在 25-35 秒之间从交换机端口发送 CDP/LLDP 流量(慢速)。
- 如果启动 120 秒后没有输出
tcpdump,结束命令。交换机可能未发送数据包。
以下 tcpdump 命令仅侦听 CDP 数据包,打印数据包,然后停止运行(手动进入接口):
tcpdump -ni <iface> -v -s0 -c1 '(ether[20:2]=0x2000)'
以下 tcpdump 命令仅侦听 LLDP 数据包,打印数据包,然后停止运行(手动进入接口):
tcpdump -ni <iface> -v -s0 -c1 '(ether[12:2]=0x88cc)'
以下 tcpdump 命令侦听 LLDP 和 CDP 数据包,打印收到的第一个数据包,然后停止运行(手动进入接口):
tcpdump -ni <iface> -v -s0 -c1 '(ether[12:2]=0x88cc or ether[20:2]=0x2000)'
其他信息
使用哪个命令因交换机供应商而异。
CDP 示例(输出可能会有所不同):
isilon-1# tcpdump -ni cxgb0 -v -s0 -c1 '(ether[20:2]=0x2000)'
tcpdump: WARNING: cxgb0: no IPv4 address assigned
tcpdump: listening on cxgb0, link-type EN10MB (Ethernet), capture size 65535 bytes
13:09:18.942158 CDPv2, ttl: 180s, checksum: 692 (unverified), length 248
Device-ID (0x01), length: 25 bytes: 'nx-5k(XXXXXXXXXXX)'
Address (0x02), length: 13 bytes: IPv4 (1) Y.Y.Y.Y
Port-ID (0x03), length: 11 bytes: 'Ethernet1/2'
Capability (0x04), length: 4 bytes: (0x00000228): L2 Switch, IGMP snooping
Version String (0x05), length: 66 bytes:
Cisco Nexus Operating System (NX-OS) Software, Version 4.1(3)N2(1)
Platform (0x06), length: 14 bytes: 'N5K-C5010P-BFS'
Native VLAN ID (0x0a), length: 2 bytes: 1XX
Duplex (0x0b), length: 1 byte: full
MTU (0x11), length: 4 bytes: 1500 bytes
System Name (0x14), length: 12 bytes: 'nx-5k'
System Object ID (not decoded) (0x15), length: 14 bytes:
0x0000: XYXY XYXY XYXY XYXY XYXY XYXY XYXY
Management Addresses (0x16), length: 13 bytes: IPv4 (1) Y.Y.Y.Y
Physical Location (0x17), length: 13 bytes: 0x00/snmplocation
1 packet captured
25 packets received by filter
0 packets dropped by kernel
LLDP 示例(输出可能会有所不同):
isilon-1# tcpdump -ni ix0 -v -s0 -c1 '(ether[12:2]=0x88cc)'
tcpdump: WARNING: ix0: no IPv4 address assigned
tcpdump: listening on ix0, link-type EN10MB (Ethernet), capture size 65535 bytes
18:12:46.442857 LLDP, length 282
Chassis ID TLV (1), length 7
Subtype MAC address (4): xy:xy:xy:xy:xy:xy
Port ID TLV (2), length 13
Subtype Interface Name (5): Ethernet1/13
Time to Live TLV (3), length 2: TTL 120s
Port Description TLV (4), length 12: isi_node
System Name TLV (5), length xy: XXXXXX
System Description TLV (6), length 161
Cisco Nexus Operating System (NX-OS) Software ...truncated
System Capabilities TLV (7), length 4
System Capabilities [Bridge, Router] (0x0014)
Enabled Capabilities [Bridge, Router] (0x0014)
Management Address TLV (8), length 12
Management Address length 5, AFI IPv4 (1): Y.Y.Y.Y
Interface Index Interface Numbering (2): 1
Organization specific TLV (127), length 5: OUI Unknown (0x000142)
0x0000: 0001 XYXY XY
Organization specific TLV (127), length 6: OUI Ethernet bridged (0x0080c2)
Port VLAN Id Subtype (1)
port vlan id (PVID): 1XX
Management Address TLV (8), length 14
Management Address length 7, AFI 802 (6): xy:xy:xy:xy:xy:xy
Interface Index Interface Numbering (2): 1
End TLV (0), length 0
1 packet captured
3 packets received by filter
0 packets dropped by kernel