> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/upg/2.2/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/upg/2.2/troubleshooting/traffic-capturing.md).

# Traffic Capturing

Traffic on UPG is handled only inside the VPP framework. Tools to capture traffic using kernel network
stack (like `tcpdump` or `ip`) are not useful for UPG debugging.

## VPP Packet Tracing

There are many commands in VPP CLI for debugging, and most of them are documented in FPP Troubleshooting docs.

Commands available there:
- `trace add <input> <num>`
- `show trace`
- `clear trace`
- `pcap trace`

> **Warning**
>
> `trace` and `pcap trace` CLI commands use memory to store the trace, so before using it, assess how much
> memory is left on the pod. The alternative is to use kernel based pcap capturing inside workload pod that
> uses TAP interface.

[VPP trace facility](https://s3-docs.fd.io/vpp/22.06/gettingstarted/progressivevpp/traces.html)
can be used for in-depth debugging of network connectivity.

Dispatch trace VPP facility captures the traversal of the VPP node graph by the buffers (packets), e.g.:

```bash
$ vppctl pcap dispatch trace on max 10000 file trace-file.pcap buffer-trace memif-input 100
```

The command above can take up to 20-30Mb RAM to gather the traffic. To stop
the trace, run `pcap dispatch` trace off`, and the result will be saved in
`/tmp/trace-file.pcap`. For later analysis, this file needs to be copied from
the pod to an external machine by hand, for example by `kubectl cp` command:

```bash
$ kubectl cp -n upg-ns <upg-pod-name>:/tmp/trace-file.pcap ./trace-file.pcap
```
