Configure PCAP capturing
Configuring PCAP collection using Kubernetes objects allows you to manage the entire setup in a centralized and declarative way. To do so, you must create and configure these two Kubernetes Custom Resources (CRs):
NetCaptureStorage- specifies the storage location for collected PCAP filesNetCaptureJob- defines the traffic capture configuration, including the source interface, start time and duration of traffic capture, and destinations
The configuration below is a simplified example that shows how to set up traffic capturing with NetCap. For a complete description of available configuration options, read About PCAP capturing.
Depending on your preference, you can configure PCAP collection using either Cennso Management Console (CMC) or CLI.
Set a storage location
First, create a NetCaptureStorage object to configure a storage where PCAP files will be stored:
- Go to Cennso Management → Network Applications → + New, and choose the
NetCapture Storagetile. - In the Metadata tab of the form, provide the name for your
NetCapture Storageinstance. You can also specify Kubernetes labelsOpens in a new tab and annotationsOpens in a new tab. - Switch to the Specification tab and choose a storage type for your PCAPs: local, SFTP, or S3. Provide a path if you choose local storage (PCAPs saved on the NetCap Sink pod), or the necessary connection parameters if using SFTP or S3. NetCap supports all the rclone connection parameters. For the full set of fields, refer to the rclone SFTP documentationOpens in a new tab or rclone S3 documentationOpens in a new tab.
- Click Create.
Note
If you do not specify a destination in the Specification tab, by default PCAPs will be stored on the local disc in the Kubernetes Worker node where the NetCap Sink is running. The default path is /root/dumps.
To configure storage using the CLI, create a YAML file (for example: netcapture-storage.yaml) defining a NetCaptureStorage Custom Resource (CR) and specify the desired storage for your PCAPs:
-
To set a local disk as a storage, set spec.forProvider.local.path to the local path where you want to store PCAPs. In this example, the PCAPs will be stored in the default
/root/dumpsdirectory:yaml -
To set a storage accessible through SFTP, use the spec.forProvider.sftp configuration option. See the example:
yaml -
To set S3 as a storage, use the spec.forProvider.s3 configuration option. See the example:
yaml
Then, apply the NetCaptureStorage CR to your cluster using this command:
For more details on the NetCaptureStorage configuration, see the dedicated sections:
Provide traffic capture configuration
Now that you configured the storage for PCAPs, you can specify other PCAP configuration options using NetCaptureJob:
- Go to Cennso Management → Network Applications → + New, and choose the
NetCapture Jobtile. - In the Metadata tab of the form, provide the name for your
NetCapture Jobinstance. You can also specify Kubernetes labelsOpens in a new tab and annotationsOpens in a new tab. - Switch to the Specification tab and fill out the form:
- In the Cluster field, choose the cluster to which this configuration should be applied.
- In the Selector field, specify a name and a namespaces of the VPP pod to target.
- In the Capture time schedule section, choose whether your traffic capture should occur one-time or periodically. For a one-time capture, specify the start and end time. For a periodic capture, define the schedule and duration.
- In the Traffic stream source section, specify whether you want to capture traffic passing through the specified interface, or based on the specified IMSI. Here you can also provide all the configuration options you would like to apply to your traffic capture.
- In the Traffic stream destination section, provide parameters that define a PCAP file and storage information including a reference to the
NetCaptureStorageobject created before.
- Click Create.
Create a YAML file with the NetCaptureJob CR (for example: netcapture-job.yaml). Make sure to fill all the necessary fields and references. See the example:
Note
Make sure the destinationTemplate.spec.destinations.storage parameter contains proper reference to the NetCaptureStorage object.
After that, apply the NetCaptureJob CR to your cluster using this command:
See the NetCaptureJob status
You can see the status of your NetCaptureJob to check if the stream was created successfully, packets were captured and forwarded, and whether any errors occurred during stream or destination setup.
To see the NetCaptureJob status:
- Go to Cennso Management → Network Applications and choose your
NetCaptureJobfrom the list of resources. - The status of the selected
NetCaptureJobis visible on the Overview → Status tab. - Click Details to see detailed information about
NetCaptureJob.
Run this command:
See the status example after object creation:
See the status example after the packets are sent:
See the status example when an error occurs:
Note
Most errors occur due to misconfigured resources. Double-check field values and references if an error appears.
Next steps
As a next step, you can inspect a live view of captured traffic using Wireshark. See the Observe real-time traffic in Wireshark document for more details.