For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

You are reading Fast Path Provider 1.3, an older release. The newest release is 3.2. Go to 3.2

MEMCAP traffic capturing

You can use the MEMCAP plugin for traffic capturing.

MEMCAP is a framework that defines and implements a protocol for offloading the traffic capturing process using the memory-mapped interface. This approach reduces the operational overhead on the capturing component. Captured data is subsequently collected and processed by the MEMCAP Sink sub-component. By delegating resource-intensive tasks, such as I/O processing and system upgrades, to separate components, MEMCAP reduces resource requirements and improves scalability.

The Fast Path Provider (FPP) pod acts as a traffic collector and communicates with the MEMCAP Sink pod using a shared memory interface. Multiple FPP-based instances, such as FPP, Connectivity Gateway (CGW) or User Plane Gateway (UPG), located on a single node communicate with a single MEMCAP Sink pod located on the same node.

MEMCAP diagram
MEMCAP diagram

Terminology

Here's the terminology used within this document:

  • Collector - FPP pod which provides capture streams. It can provide multiple PCAP streams in parallel.
  • Sink - a component that receives data from collectors, processes it, and outputs as .pcapng files.
  • Class - a traffic class which allows for different processing in MEMCAP Sink. For example, hw_iface_l2 is a VPP interface-based L2 traffic capturing, and upf_session_ip is a UPG IMSI-based IP traffic capturing.
  • Target - an arbitrary name used to direct traffic capture streams to destinations. On the collector side, different traffic capture streams can use the same target name. On the MEMCAP Sink side, different destinations can use the same target name as well. Target names can be chosen arbitrarily and do not require provisioning in advance.
  • Stream - an instance of active traffic capture. For example, a stream of interface eth0 to target eth-if with class hw_iface_l2.
  • Destination - the endpoint for a PCAP stream, which can be a file or an HTTP stream.

MEMCAP consists of the following sub-components:

  • VPP MEMCAP plugin implements the collector side of the MEMCAP connection. It implements the hw_iface_l2 collector, which allows you to collect traffic from L2 VPP interfaces. It also provides a framework for easy integration with other VPP plugins.

  • MEMCAP Sink manages connections to collectors and processes the captured traffic data. It outputs the data in the .pcapng file format, which you can save to a disk with options for compression and rotation. Additionally, it allows streaming of .pcapng files over an HTTP connection for real-time analysis.

This is a sample operational workflow:

MEMCAP flow
MEMCAP flow

Installation

MEMCAP Sink is installed as a regular Helm chart. To install it, use the following command:

bash

The -n fpp part of the command specifies a namespace where the MEMCAP sink will be deployed. For more details about the memcap.yaml file, read the Configuration section below.

Configuration

You can configure MEMCAP Sink using Helm chart configurable parameters. Such configuration allows you to:

  • Name a PCAP file
  • Enable file rotation
  • Define how many packets are stored in a single file
  • Define the maximum number of files
  • Enable file compression

These are the parameters that you can configure:

See the MEMACAP sink configuration example:

yaml

This configuration creates a single PCAP file for two targets (pgw-pfcp and scg-pfcp). The PCAP file is stored in the MEMCAP pod in the location specified in the file_prefix field. A file name always contains an autogenerated suffix to avoid collisions during rotations or restarts. You can copy a PCAP file from the pod to an external machine for further analysis. For example, you can use this command:

bash

Usage

Enable traffic capturing

To initiate traffic capturing on a specific interface, use this command:

text
  • filter {tcpdump filter} - allows you to define libpcap-based filters that are the same as in the tcpdump utility. The filter format is described in the libpcap documentation man pcap-filter. Examples: filter {arp or icmp}, filter {src net 192.0.2.0/24 and port 2020}.
  • packet_max_bytes is an optional parameter which allows you to limit the size of collected data to reduce memory usage of a traffic capture
  • rx and tx allow you to specify the direction in which traffic should be collected. Leaving those flags out collects traffic in both directions.

Note that you can create multiple captures for the same interface when using different capture targets. This is useful if you want to simultaneously collect differently filtered traffic to separate files from a single interface.

Each active stream on the interface may slow down the entire interface performance. To reduce performance degradation, it's best to keep the number of streams attached to interfaces low. This can be done by combining filters using the libpcap or operator.

Disable traffic capturing

To disable traffic capturing on a specific interface, use this command:

text

Monitor traffic capture

To view the created interface captures, use the command:

text

See the output example:

text

To view all the created MEMCAP streams from all plugins, use the command:

text

See the output example:

text

To view MEMCAP connection state, use the command:

text

See the output example:

text

Capture information

You can use the additional metadata provided in a .pcapng file for advanced filters in tools like Wireshark:

Simultaneous streaming through HTTP

Currently, MEMCAP Sink does not support simultaneous streaming from multiple nodes through a single connection. For simultaneous streaming on multiple nodes, you must repeat these steps for every node:

  1. Set up port forwarding to one of MEMCAP Sink pods. The pod must be located on the node where you want to capture traffic.

    bash

    This command maps port 9999 on your local machine, allowing direct access to the streaming service.

  2. To start streaming the .pcapng file to Wireshark, create an HTTP request and redirect it as a stream to Wireshark. You can specify multiple target names in the URL, separated by commas, to select the traffic capture as required.

    bash

    This command performs the following actions:

    • curl --compressed - starts a cURL and requests a server to perform the request compression and decompression before writing data to a pipe.
    • localhost:9999/pcap/TARGET1,TARGET2,TARGET3 - URL to the forwarded MEMCAP Sink API port with a comma-separated list of target names.
    • -N - disables pipe buffering to ensure real-time updates in Wireshark.
    • | wireshark -k -i - - sends (pipes) the output from curl directly into Wireshark, which starts analyzing the stream immediately.
    • -o 'gui.window_title:memcap-stream' - sets the Wireshark window title for easy identification.
    • -o 'capture.no_interface_load:TRUE' - prevents Wireshark from listing local interfaces, which speeds up the startup.

As a result, you should see live traffic in Wireshark.