I have a RHEL server with several apps on it and I am attempting to figure out which one of them is making calls to an external web service. I have TCP dumps that show the calls being made and through various tools I am able to determine what ephemeral port is making those calls. However, I am unable to figure out how to map that ephemeral port to a pid. I am aware that I can use lsof -i
to map bound ports to pids, but this is not my problem.
Is there any way to map an in-use ephemeral port to a pid or some other indicator as to what file is making the call?
Any of those should work. Below is sample output showing my mail client using ephemeral port 56375 to talk to an IMAP server for further explanation:
netstat
will list all pid and port respective to each other.netstat -nlp
will provide you port to pid mapping.