大网数据广告活动
服务器运维问答

Determine process (and user) that is creating packets to given IP

· 52CE 我爱测

Given an external IP address and target port, in Linux, is there any way to use something like ngrep or tcpdump to identify the process and/or user that is sometimes sending traffic to it? Or iptables rules? Is there a recommende…

问题原文

原帖链接 · chell · CC BY-SA 3.0

Given an external IP address and target port, in Linux, is there any way to use something like ngrep or tcpdump to identify the process and/or user that is sometimes sending traffic to it? Or iptables rules? Is there a recommended way to run an ongoing monitor that's not too resource intensive?

已采纳解答

原帖链接 · chell · CC BY-SA 3.0

Rich Alloway - RogueWave's answer had some promising suggestions, but each package falls short in one way or another. The only option I could find that satisfied all my needs was sysdig

There's many ways to use it, such as:

sysdig -p "*%evt.num %evt.datetime %evt.cpu (%user.name) %proc.name (%thread.tid) %evt.dir %evt.type %evt.info" '(fd.rnet=1.2.0.0/16 or fd.rnet=3.4.5.0/24) and fd.rport=443' | tee outputfile

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-02-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。