Skip to main content

 

Cisco Meraki Documentation

How to Capture Packets Using Port Mirroring on MS

Overview 

Workstations in promiscuous mode sniff LAN packets within their broadcast domain. A workstation connected to Cisco Meraki switches captures these packets through port mirroring. 

This article explains how to capture traffic passed by an MS switch using the following steps: 

  1. Enable port mirroring on your switch. 
  2. Connect a workstation to your destination port. 
  3. Capture packets in promiscuous mode. 

The most effective way to capture traffic passed on a given switchport is to mirror that port to another available port, so the switch sends all traffic from the source port out on the mirrored destination port. 

Learn more with this free online training course on the Meraki Learning Hub:

Sign in with your Cisco SSO or create a free account to start training.

Port mirror egress modes 

Meraki switches offer two egress modes for port mirrors: 

  • True egress — Native VLAN traffic is untagged. 

  • Tagged egress — Native VLAN is tagged. 

The following switches support each mode: 

  • True egress: MS22, MS42, MS120, MS220, MS320, MS350, MS390, MS410, Meraki managed and monitored Catalyst switches. 

  • Tagged egress: MS225, MS250, MS420, MS425. 

Capture filter types 

You can filter a capture for a specific client's IP address or for a specific type of traffic. Filter either before or after the capture. The filters used for each differ. 

  • Capture filter — Limits the type of data the switch captures and saves to the file. This filter is used less frequently. Its syntax differs from display filters. Refer to the Wireshark database for capture filter syntax. 

  • Display filter — The more common filter type. It does not reduce the traffic captured, which eliminates the possibility of applying an incorrect filter and missing the traffic required to troubleshoot. Apply this filter inside Wireshark when viewing the completed capture. Refer to the Wireshark database for display filter syntax. 

Understanding a rolling capture 

A rolling capture automatically saves the output to files at set intervals and breaks up a large capture into multiple smaller files. This helps when running a long-term capture for troubleshooting intermittent issues such as choppy audio on VOIP. 

For some issues, you may need to run port mirrors or span port captures for long periods until the issue occurs. The goal is to run a capture and stop it once the issue surfaces. A capture run for a long duration—6 hours, for example—produces a .pcap file too large for your computer to open, since captures larger than 100 MB become difficult to open on some computers. Configure the capture with multiple options to make this easier. 

Understanding the ring buffer 

Set ring buffers to ensure you do not fill up all the disk space on your device. The ring buffer starts overwriting the oldest file based on how many files you specify. You do not have to use it, but it helps ensure you do not fill up your HDD. 

Prerequisites 

  • Two ports on the same MS switch or within the same switch stack—one source port and one destination port. 
  • A workstation to connect to the destination port, with DHCP enabled on the host. 
  • Wireshark installed on the workstation. Refer to Wireshark's download page to download Wireshark, then follow the prompts. 

The MS switch supports utilizing aggregate ports as a source port only (not as a destination port). The uplink port cannot be used as the destination and is not listed as an option.

Uplink port not shown as an option for destination of port mirroring

Step-by-step instructions 

Enable port mirroring on your switch 

Mirror one or more ports on an MS switch: 

  1. In the Meraki dashboard, navigate to Switch > Monitor > Switch port    s

  1. Select one or more ports to be mirrored. You can mirror multiple source ports to a single destination port. 

  1. Select Mirror

Selecting source ports for mirroring - Switch Ports Dashboard UI

  1. Specify the destination mirror port, which captures traffic on the source ports. Both ports must be on the same switch or within the same switch stack. You can have multiple source ports but only a single destination port. 

  1. Select Create port mirror

Selecting destination switch and port for mirroring - Dashboard UI

Connect a workstation to your destination port 

  1. Physically connect a workstation to your destination port. 

  1. Make sure DHCP is enabled on the host. 

  1. Confirm the host receives a 169.254.X.X IP address. 

Workstation PC CLI with APIPA IP address via DHCP

Clients connected to a destination port of a port mirror do not have network connectivity, as the destination port does not serve clients. 

Take a packet capture with Wireshark 

Wireshark displays the packets a device sees. Packets contain the data transmitted between computers, and viewing this information often aids in diagnosing network issues. A hardwired device may not see all packets transmitted on a network; it may only see broadcast packets and packets addressed to itself due to the functionality of modern networking equipment. 

  1. Open Wireshark

  1. Select Capture Options

  1. Uncheck Enable promiscuous mode on all interfaces, check the Promiscuous option for your capture interface, and select the interface. 

UI of Wireshark interface selection and setting promiscuous mode

  1. Select Start. A new window shows the packets the device picks up. 

UI of Wireshark interface selection and clicking 'start' to start capturing

  1. Select Stop once you obtain the desired packets.

UI of Wireshark 'stop capture' button

  1. Save the capture from the File menu with a distinct name. 

Learn more with this free online training course on the Meraki Learning Hub:

Sign in with your Cisco SSO or create a free account to start training.

Take a rolling capture 

  1. Open Wireshark

  1. Select Capture Options

  1. Uncheck Enable promiscuous mode on all interfaces, check the Promiscuous option for your capture interface, and select the interface. 

UI of Wireshark interface selection and not setting promiscuous mode

  1. In the Output tab, select Browse

Screen Shot 2018-03-08 at 12.56.40 PM.png

  1. Enter a filename in the Save As field, select a folder to save captures to, and select Save

Wireshark UI depicting where to save a pcap file

6. Select Create a new file automatically after… and Use a ring buffer with x files. This creates a maximum of x files, with each file set to the size or timeframe configured. For example, creating a new file automatically after 32 megabytes with a ring buffer of 128 files provides 4 gigabytes of rolling captures. 

Wireshark UI depicting the rolling packet capture settings window

  1. Select Start. A new window shows the packets the device picks up. 

Apply a display filter 

  1. Open your packet capture. 

  1. Select the filter box. 

Wireshark UI depicting the capture filter with a protocol entered in to filter the output

  1. Input the filter string as provided by your support engineer, then select Apply

  1. To save the filtered data, go to File > Export Specified Packets

Wireshark UI depicting where to view/export specific packets

  1. Make sure the Displayed radio button is checked and the file has a unique filename, then select Save

Wireshark UI depicting where to save a file with specific exported packets

Verification 

  • After creating the port mirror, the workstation connected to the destination port receives a 169.254.X.X IP address, confirming the connection. 
  • After starting the capture in Wireshark, the capture window displays the packets the device picks up, confirming that mirrored traffic reaches the workstation. 

Troubleshooting 

  • A workstation connected to a destination port does not have network connectivity, because the destination port does not serve clients. This is expected behavior. 
  • If a capture runs for a long duration, the resulting .pcap file may exceed 100 MB and become difficult to open. Use a rolling capture with a ring buffer to break the output into smaller files and avoid filling your disk. 
  • Was this article helpful?