How to do VPP Packet Tracing in Kubernetes
This document describes the steps to do manual packet tracing (capture) using
VPP in Kubernetes. Contiv/VPP also ships with a simple bash script
vpptrace.sh,
which allows to continuously trace and
filter packets incoming through a given set of interface types.
Documentation for vpptrace.sh is available here.
More information about VPP packet tracing is in:
- https://wiki.fd.io/view/VPP/Command-line_Interface_(CLI)_Guide#packet_tracer
- https://wiki.fd.io/view/VPP/How_To_Use_The_Packet_Generator_and_Packet_Tracer
- https://wiki.fd.io/view/VPP/Tutorial_Routing_and_Switching
SSH into the Node
Perform the following commands to SSH into the node:
1 | cd vpp/vagrant/vagrant-scripts/ |
Check the VPP Graph Nodes (Input and Output Queues)
The following content shows what is running on VPP, via the show run
command
1 | vagrant@k8s-worker1:~$ sudo vppctl |
tapcli-rx
above is the node-level input queue for incoming packets into all the pods on the node. There is one tapcli-rx
input queue for every node.
The following are the input and output queueus for each pod and the node:
1 | tapcli-0-output |
Each pod and node has two queues, one for rx (tapcli-X-output
), and one for tx (tapcli-X-tx
). The above output is with two nginx
pods in kubernetes.
Clear Existing VPP Packet Trace
Enter the following command:
1 | vpp# clear trace |
How to Turn on VPP Packet Tracing
Enter the following commands:
1 | vpp# trace add <input or output queue name> <number of packets to capture> |
Send Traffic to the Pods
Open another terminal, SSH into the master node, refer the documentation in vpp/vagrant/README.md
and send traffic to the two nginx
pods using wget
.
1 | cd vpp/vagrant/vagrant-scripts/ |
Check the Packets Captured by VPP
Back in the first terminal, check the packets captured by VPP.
1 | vpp# show trace |
In the above captured packet, we can see:
- Input queue name
tapcli-rx
- Pod’s IP address
10.1.2.3
- IP address of the master node
172.30.1.2
, which sent thewget
traffic to the two pods - HTTP port
80
, destination port and TCP protocol (TCP: 80 -> 58430
) - NAT queue name
nat44-out2in
- VXLAN VNI ID
VXLAN encap to vxlan_tunnel0 vni 10
- VXLAN UDP port
4789
- IP address of
GigabitEthernet0/8/0
interface (192.168.16.2
) - Packet on the outgoing queue
GigabitEthernet0/8/0-tx
Find IP Addresses of GigabitEthernet and the Tap Interfaces
Enter the following commands to find the IP addresses and Tap interfaces:
1 | vpp# show int address |
Other Useful VPP CLIs
Enter the following commands to see additional information about VPP:
1 | vpp# show int |