How do you find which process is responsible for a connection or a burst of outbound traffic?
AdvancedConceptCommand-Line Tools & Diagnostics
Answer
ss -tnp dst 203.0.113.10
sudo lsof -i @203.0.113.10
sudo nethogs eth0 # bandwidth per process
sudo bpftrace -e 'tracepoint:tcp:tcp_retransmit_skb { @[comm] = count(); }'
For containers, enter the namespace: nsenter -t <pid> -n ss -tnp. In Kubernetes use kubectl debug node/... or an ephemeral container with netshoot.
More on Command-Line Tools & Diagnostics
How do you check if a remote port is open?BeginnerHow do you list listening ports and the processes that own them?BeginnerWhat does `ping` tell you and what does it not?BeginnerHow does traceroute work and how do you read the output?BeginnerWhat is mtr and why is it better than traceroute?IntermediateHow do you query DNS with dig and read the answer?Beginner