Steps to identify the Pod level interface name to run a tcpdump (to capture network packets). This article is similar to How to Capture Networking Traffic of an Mule Application Pod in RTF, which provides a downloadable script instead of manual steps.
Note: This article is for RTF Appliance, which is now EOL, for RTF BYOK, you can refer this article.
1. docker ps | grep -i <pod_name>
2. docker inspect <id_from_prev_output> --format '{{ .State.Pid }}'
3. nsenter -t <id_from_prev_output> -n ip addr
4. ip addr | grep "^<eth_number_from_prev_output>"
5. tcpdump -nnvp -i <veth_from_prev_output> '<filter>' [<other tcpdump options>]
ip-172-31-0-5:/$ docker ps | grep ah-rtf-hello-v1 ... 9d6df4501765 494141260463.dkr.ecr.us-east-1.amazonaws.com/mulesoft/poseidon-runtime-4.2.2 "/docker-entrypoint.…" 19 minutes ago Up 19 minutes k8s_app_ah-rtf-hello-v1-dc55d465b-mmqg4_fff5df7b-c49d-48c9-967d-0071412717c4_b81042e5-a7b7-11eb-8163-02a1dbec8f10_0 ...
ip-172-31-0-9:/$ docker inspect 9d6df4501765 --format '{{ .State.Pid }}'
26224
3. Ignore the loopback interface. Look for the ethernet interface (in this case eth0). In below output we will note down eth0@if189, which means interface number 189 running on eth0.
ip-172-31-0-9:/$ nsenter -t 26224 -n ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
3: eth0@if189: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 8951 qdisc noqueue state UP group default
link/ether 8a:eb:5e:97:02:81 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.244.3.26/24 brd 10.244.3.255 scope global eth0
valid_lft forever preferred_lft forever
4. Look for the line starting with "189" that was identified in previous step. Note down the veth name veth731c8fbe@if3.
ip-172-31-0-9:/$ ip addr | grep "^189" 189: veth731c8fbe@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 8951 qdisc noqueue master cni0 state UP group default5. Tcpdump command will use the interface veth731c8fbe (remove @if3) identified from previous step. Example below filters for port 25 traffic and saves the output to a file.
tcpdump -nnvp -i veth731c8fbe 'port 25' -w /ext/share/pod_capture.pcap6. After traffic has been captured, stop the tcpdump command (e.g. control+C or kill the tcpdump process)
001116257

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.