Home > Articles > NX-OS Troubleshooting Tools

NX-OS Troubleshooting Tools

Chapter Description

In this sample chapter from Troubleshooting Cisco Nexus Switches and NX-OS, you will review the various tools available on the Nexus platform that can help in troubleshooting and day-to-day operation.

Nexus Platform Tools

Nexus switches are among the most powerful data center switches in the industry. This is partly because of the CPU and memory available in the switch, but also because of the wide range of integrated tools that the NX-OS offers. These tools provide the capability to capture packets at different ASIC levels within the switch and help verify both hardware programming and the action taken by the hardware or the software on the packet under investigation. Some of these tools include the following:

  • Ethanalyzer

  • Embedded Logic Analyzer Module (ELAM)

  • Packet Tracer

These tools are capable of performing packet capture for the traffic destined for the CPU or transit hardware-switched traffic. They are helpful in understanding the stages the packet goes through in a switch, which helps narrow down the issue very quickly. The main benefit of these features is that they do not require time to set up an external sniffing device.

Ethanalyzer

Ethanalyzer is an NX-OS implementation of TShark, a terminal version of Wireshark. TShark uses the libpcap library, which gives Ethanalyzer the capability to capture and decode packets. It can capture inband and management traffic on all Nexus platforms. Ethanalyzer provides the users with the following capabilities:

  • Capture packets sent and received by the switch Supervisor CPU

  • Define the number of packets to be captured

  • Define the length of the packets to be captured

  • Display packets with very detailed protocol information or a one-line summary

  • Open and save captured packet data

  • Filter packets capture on many criteria (capture filter)

  • Filter packets to be displayed on many criteria (display filter)

  • Decode the internal header of control packet

  • Avoid the requirement of using an external sniffing device to capture the traffic

Ethanalyzer does not allow hardware-switched traffic to be captured between data ports of the switch. For this type of packet capture, SPAN or ELAM is used. When the interfaces are configured with ACLs with ACEs configured with the log option, the hardware-switched flows gets punted to the CPU and thus are captured using Ethanalyzer. However, this should not be tried in production because the packets could get dropped as a result of CoPP policies or the excessive traffic punted to the CPU could impact other services on the device.

Ethanalyzer is configured in three simple steps:

  • Step 1. Define capture interface.

  • Step 2. Define Filters: Set the capture filter or display filter.

  • Step 3. Define the stop criteria.

There are three kinds of capture interfaces:

  • Mgmt: Captures traffic on the Mgmt0 interface of the switch

  • Inbound-hi: Captures high-priority control packets on the inband, such as Spanning Tree Protocol (STP), Link Aggregation Control Protocol (LACP), Cisco Discovery Protocol (CDP), Data Center Bridging Exchange (DCBX), Fiber Channel, and Fiber Channel over Ethernet (FCOE)

  • Inbound-low: Captures low-priority control packets on the inband, such as Internet Group Management Protocol (IGMP), Transmission Control Protocol (TCP), User Datagram Protocol (UDP), Internet Protocol (IP), and Address Resolution Protocol (ARP) traffic

The next step is to set the filters. With a working knowledge of Wireshark, configuring filters for Ethanalyzer is fairly simple. Two kinds of filters can be set up for configuring Ethanalyzer: capture filter and display filter. As the name suggests, when a capture filter is set, only frames that match the filter are captured. The display filter is used to display the packets that match the filter from the captured set of packets. That means Ethanalyzer captures other frames that do not match the display filter but are not displayed in the output. By default, Ethanalyzer supports capturing up to 10 frames and then stops automatically. This value is changed by setting the limit-captured-frames option, where 0 means no limit.

Ethanalyzer is part of the software running on the supervisor, so it is important to understand its effects on the supervisor’s CPU. Normally, Ethanalyzer does not have much impact, but sometimes it can increase the CPU utilization up to 5%. Utilization can be reduced by 1% to 2% by saving the capture data in a file using the write option with Ethanalyzer to save the capture in a file.

To start a packet capture with Ethanalyzer, use the command ethanalyzer local interface [inbound-hi | inbound-lo | mgmt] options, with the following options:

  • Autostop: Capture autostop condition

  • capture-filter: Filter on Ethanalyzer capture

  • capture-ring-buffer: Capture ring buffer option

  • decode-internal: Include internal system header decoding

  • detail: Display detailed protocol information

  • display-filter: Display filter on frames captured

  • limit-captured-frames: Indicates the maximum number of frames to be captured

  • limit-frame-size: Capture only a subset of a frame

  • write: Identifies the filename to save capture to

While using Ethanalyzer, specifying the filters is easier for someone who is familiar with Wireshark filters. The syntax for both the capture filter and the display filter is different. Table 2-1 lists some of the common filters and their syntax with the capture-filter and display-filter options.

Table 2-1 Ethanalyzer Capture and Display Filters

 

Capture Filter

Display Filter

Operators

 

And - &&

Or - ||

Equal - ==

Not equal - !=

VLAN

vlan vlan-id

vlan.id==vlan-id

Layer 2

ether host 00:AA:BB:CC:DD:EE

ether dst 00:AA:BB:CC:DD:EE

ether src 00:AA:BB:CC:DD:EE

ether broadcast

ether multicast

ether proto protocol

eth.addr==00:AA:BB:CC:DD:EE

eth.src==00:AA:BB:CC:DD:EE

eth.dst==00:AA:BB:CC:DD:EE

Match first 2 bytes:

eth.src[0:1]==00:AA

Filter on manufacturer:

eth.src[0:2]==vendor-mac-addr

e.g., Cisco: eth.src[0:2]==00.00.0c

eth.addr contains aa:bb:cc

Layer 3

ip (filters out lower-level protocols such as ARP and STP)

host 192.168.1.1

dst host 192.168.1.1

src host 192.168.1.1

net 192.168.1.0/24

net 192.168.1.0 netmask 24

src net 192.168.1.0/24

dst net 192.168.1.0/24

ip broadcast

ip multicast

not broadcast

not multicast

icmp

udp

tcp

ip proto 6 (udp)

ip proto 17 (tcp)

ip proto 1 (icmp)

Packet length:

less length

greater length

IP address:

ip.addr==192.168.1.1

Source IP:

ip.src==192.168.1.1

Dest IP:

ip.dst==192.168.10.1

Subnet:

ip.addr==192.168.1.0/24

Fragmentation:

Filter on DF bit set (0 = may fragment)

ip.flags.df==1

TCP Sequence:

tcp.seq==TCP-Seq-Num

Layer 4

udp port 53

udp dst port 53

udp src port 53

tcp port 179

tcp portrange 2000-2100

tcp.port==53

udp.port==53

FabricPath

proto 0x8903

Dest HMAC/MC destination:

cfp.d_hmac==mac

cfp.d_hmac_mc==mac

EID/FTAG/IG Bit:

cfp.eid==

cfp.ftag==

cfp.ig==

Source LID/OOO/DL Bit/Source HMAC:

cfp.lid==

cfp.ooodl==

cfp.s_hmac==

Subswitch ID/Switch ID/TTL:

cfp.sswid==

cfp.swid==

cfp.ttl==

ICMP

icmp

icmp==icmp-type

ICMP-Types:

icmp-echoreply

icmp-unreach

icmp-sourcequench

icmp-redirect

icmp-echo

icmp-routeradvert

icmp-routersolicit

icmp-timxceed

icmp-paramprob

icmp-tstamp

icmp-tstampreply

icmp-ireq

icmp-ireqreply

icmp-maskreq

icmp-maskreply

Example 2-9 illustrates the use of Ethanalyzer to capture all packets hitting the inbound-low as well as inbound-hi queue on Nexus 6000. From the following outputs, notice that the TCP SYN/SYN ACK packets even for a BGP peering are part of the inbound-low queue, but the regular BGP updates and keepalives (such as the TCP packets after the BGP peering is established) and the acknowledgements are part of the inband-hi queue.

Example 2-9 Ethanalyzer Capture

N6k-1# ethanalyzer local interface inbound-low limit-captured-frames 20
Capturing on inband
2017-05-21 21:26:22.972623 10.162.223.33 -> 10.162.223.34 TCP bgp > 45912 [SYN, 
ACK] Seq=0 Ack=0 Win=16616 Len=0 MSS=1460
2017-05-21 21:26:33.214254 10.162.223.33 -> 10.162.223.34 TCP bgp > 14779 [SYN, 
ACK] Seq=0 Ack=0 Win=16616 Len=0 MSS=1460
2017-05-21 21:26:44.892236 8c:60:4f:a7:9a:6b -> 01:00:0c:cc:cc:cc CDP Device ID:
 N6k-1(FOC1934R1BF)  Port ID: Ethernet1/4  
2017-05-21 21:26:44.892337 8c:60:4f:a7:9a:68 -> 01:00:0c:cc:cc:cc CDP Device ID:
 N6k-1(FOC1934R1BF)  Port ID: Ethernet1/1  
2017-05-21 21:27:42.965431 00:25:45:e7:d0:00 -> 8c:60:4f:a7:9a:bc ARP 10.162.223
.34 is at 00:25:45:e7:d0:00
! Output omitted for brevity
N6k-1# ethanalyzer local interface inbound-hi limit-captured-frames 10
 
Capturing on inband
2017-05-21 21:34:42.821141 10.162.223.34 -> 10.162.223.33 BGP KEEPALIVE Message
2017-05-21 21:34:42.932217 10.162.223.33 -> 10.162.223.34 TCP bgp > 14779 [ACK] 
Seq=1 Ack=20 Win=17520 Len=0
2017-05-21 21:34:43.613048 10.162.223.33 -> 10.162.223.34 BGP KEEPALIVE Message
2017-05-21 21:34:43.814804 10.162.223.34 -> 10.162.223.33 TCP 14779 > bgp [ACK] 
Seq=20 Ack=20 Win=15339 Len=0
2017-05-21 21:34:46.005039    10.1.12.2 -> 224.0.0.5    OSPF Hello Packet
2017-05-21 21:34:46.919884 10.162.223.34 -> 10.162.223.33 BGP KEEPALIVE Message
2017-05-21 21:34:47.032215 10.162.223.33 -> 10.162.223.34 TCP bgp > 14779 [ACK] 
Seq=20 Ack=39 Win=17520 Len=0
! Output omitted for brevity

As stated earlier, optimal practice is to write the captured frames in a file and then read it after the frames are captured. The saved file in a local bootflash is read using the command ethanalyzer local read location [detail].

Nexus 7000 offers no option for inbound-hi or inbound-low. The CLI supports captures on the mgmt interface or the inband interface. The inband interface captures both high- and low-priority packets. Example 2-10 illustrates how to write and read the saved packet capture data. In this example, Ethanalyzer is run with a capture-filter on STP packets.

Example 2-10 Ethanalyzer Write and Read

N7k-Admin# ethanalyzer local interface inband capture-filter "stp" write
  bootflash:stp.pcap
Capturing on inband
10
N7k-Admin# ethanalyzer local read bootflash:stp.pcap
2017-05-21 23:48:30.216952 5c:fc:66:6c:f3:f6 -> Spanning-tree-(for-bridges)_00
 STP 60 RST. Root = 4096/1/50:87:89:4b:bb:42  Cost = 0  Port = 0x9000
2017-05-21 23:48:30.426556 38:ed:18:a2:27:b0 -> Spanning-tree-(for-bridges)_00
 STP 60 RST. Root = 4096/1/50:87:89:4b:bb:42  Cost = 1  Port = 0x8201
2017-05-21 23:48:30.426690 38:ed:18:a2:27:b0 -> Spanning-tree-(for-bridges)_00
 STP 60 RST. Root = 4096/1/50:87:89:4b:bb:42  Cost = 1  Port = 0x8201
2017-05-21 23:48:30.426714 38:ed:18:a2:17:a6 -> Spanning-tree-(for-bridges)_00
! Output omitted for brevity
! Detailed output of ethanalyzer
N7k-Admin# ethanalyzer local read bootflash:stp.pcap detail
Frame 1: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
    Encapsulation type: Ethernet (1)
    Arrival Time: May 21, 2017 23:48:30.216952000 UTC
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1495410510.216952000 seconds
    [Time delta from previous captured frame: 0.000000000 seconds]
    [Time delta from previous displayed frame: 0.000000000 seconds]
    [Time since reference or first frame: 0.000000000 seconds]
    Frame Number: 1
    Frame Length: 60 bytes (480 bits)
    Capture Length: 60 bytes (480 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: eth:llc:stp]
IEEE 802.3 Ethernet 
    Destination: Spanning-tree-(for-bridges)_00 (01:80:c2:00:00:00)
        Address: Spanning-tree-(for-bridges)_00 (01:80:c2:00:00:00)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory
  default)
        .... ...1 .... .... .... .... = IG bit: Group address (multicast/broadcast)
    Source: 5c:fc:66:6c:f3:f6 (5c:fc:66:6c:f3:f6)
        Address: 5c:fc:66:6c:f3:f6 (5c:fc:66:6c:f3:f6)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory
  default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Length: 39
    Padding: 00000000000000

Logical-Link Control
    DSAP: Spanning Tree BPDU (0x42)
    IG Bit: Individual
    SSAP: Spanning Tree BPDU (0x42)
    CR Bit: Command
    Control field: U, func=UI (0x03)
        000. 00.. = Command: Unnumbered Information (0x00)
        .... ..11 = Frame type: Unnumbered frame (0x03)
Spanning Tree Protocol
    Protocol Identifier: Spanning Tree Protocol (0x0000)
    Protocol Version Identifier: Rapid Spanning Tree (2)
    BPDU Type: Rapid/Multiple Spanning Tree (0x02)
    BPDU flags: 0x3c (Forwarding, Learning, Port Role: Designated)
        0... .... = Topology Change Acknowledgment: No
        .0.. .... = Agreement: No
        ..1. .... = Forwarding: Yes
        ...1 .... = Learning: Yes
        .... 11.. = Port Role: Designated (3)
        .... ..0. = Proposal: No
        .... ...0 = Topology Change: No
   Root Identifier: 4096 / 1 / 50:87:89:4b:bb:42
        Root Bridge Priority: 4096
        Root Bridge System ID Extension: 1
        Root Bridge System ID: 50:87:89:4b:bb:42 (50:87:89:4b:bb:42)
    Root Path Cost: 0
    Bridge Identifier: 4096 / 1 / 50:87:89:4b:bb:42
        Bridge Priority: 4096
        Bridge System ID Extension: 1
        Bridge System ID: 50:87:89:4b:bb:42 (50:87:89:4b:bb:42)
    Port identifier: 0x9000
    Message Age: 0
    Max Age: 20
    Hello Time: 2
    Forward Delay: 15
    Version 1 Length: 0
! Output omitted for brevity

The saved .pcap file can also be transferred to a remote server via File Transfer Protocol (FTP), Trivial File Transfer Protocol (TFTP), Secure Copy Protocol (SCP), Secure FTP (SFTP), and Universal Serial Bus (USB), after which it can be easily analyzed using a packet analyzer tool such as Wireshark.

Packet Tracer

During troubleshooting, it becomes difficult to understand what action the system is taking on a particular packet or flow. For such instances, the packet tracer feature is used. Starting with NX-OS Version 7.0(3)I2(2a), the packet tracer utility was introduced on the Nexus 9000 switch. It is used when intermittent or complete packet loss is observed.

The packet tracer is configured in two simple steps:

  • Step 1. Define the filter.

  • Step 2. Start the packet tracer.

To set up the packet tracer, use the command test packet-tracer [src-ip src-ip | dst-ip dst-ip ] [protocol protocol-num | l4-src-port src-port | l4-dst-port dst-port]. Then start the packet tracer, using the command test packet-tracer start. To view the statistics of the specified traffic and the action on it, use the command test packet-tracer show. Finally, stop the packet tracer using the command test packet-tracer stop. Example 2-11 illustrates the use of the packet tracer to analyze the ICMP statistics between two hosts.

Example 2-11 Packet Tracer Configuration and Verification

! Defining the Filter in Packet-Tracer
N9000-1# test packet-tracer src-ip 192.168.2.2 dst-ip 192.168.1.1 protocol 1

! Starting the Packet-Tracer
N9000-1# test packet-tracer start

! Verifying the statistics
N9000-1# test packet-tracer show
 
 Packet-tracer stats
---------------------
 
Module 1:
Filter 1 installed:  src-ip 192.168.2.2 dst-ip 192.168.1.1 protocol 1 

ASIC instance 0:
Entry 0: id = 9473, count = 120, active, fp, 
Entry 1: id = 9474, count = 0, active, hg, 
Filter 2 uninstalled:
Filter 3 uninstalled:
Filter 4 uninstalled:
Filter 5 uninstalled:
! Second iteration of the Output
N9000-1# test packet-tracer show
 
 Packet-tracer stats
---------------------
 
Module 1:
Filter 1 installed:  src-ip 192.168.2.2 dst-ip 192.168.1.1 protocol 1 
ASIC instance 0:
Entry 0: id = 9473, count = 181, active, fp, 
Entry 1: id = 9474, count = 0, active, hg, 
Filter 2 uninstalled:
Filter 3 uninstalled:
Filter 4 uninstalled:
Filter 5 uninstalled:
! Stopping the Packet-Tracer
N9000-1# test packet-tracer stop

Even if the incoming traffic is dropped because of an ACL, the packet tracer helps determine whether the packet is reaching the router incoming interface. To remove all the filters from the packet tracer, use the command test packet-tracer remove-all.

There are currently no related articles. Please check back later.