V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
plko345
V2EX  ›  Linux

请教一个通过端口获取进程的问题

  •  
  •   plko345 · 2022-03-21 21:49:38 +08:00 · 2307 次点击
    这是一个创建于 759 天前的主题,其中的信息可能已经有所发展或是发生改变。

    服务器 A 的 8080 端口一直收到来自 服务器 B 的请求, 但 A 上并没有进程监听在 8080 上, 但 B 上某个 SB 进程总是用随机的高端口非常频繁的发, 导致有大量 RST 报文.

    想问下, 我在 B 上, 要怎么找到是哪个进程在搞事, 因为非常快速就消失了, ss 根本无法定位.

    明天去公司想用 iptables 做个 drop 规则不知道会不会让这个连接保留一段时间.

    3 条回复    2022-03-22 18:13:41 +08:00
    hasdream
        1
    hasdream  
       2022-03-22 09:07:37 +08:00   ❤️ 1
    bcc-tools(redhat yum install bcc-tools -y) 工具 tcplift -D 8080 (连接远程 8080 的进程 id 都会打印)
    # ./tcplife -D 80
    PID COMM LADDR LPORT RADDR RPORT TX_KB RX_KB MS
    27448 curl 100.66.11.247 54146 54.154.224.174 80 0 1 263.85
    27450 curl 100.66.11.247 20618 54.154.164.22 80 0 1 243.62
    27452 curl 100.66.11.247 11480 54.154.43.103 80 0 1 231.16
    27454 curl 100.66.11.247 31382 54.154.15.7 80 0 1 249.95

    参考: https://www.brendangregg.com/blog/2016-11-30/linux-bcc-tcplife.html
    tomychen
        2
    tomychen  
       2022-03-22 14:23:14 +08:00
    netstat -antp,如果不行,就再加上 watch
    plko345
        3
    plko345  
    OP
       2022-03-22 18:13:41 +08:00 via Android
    @tomychen 不行,0.0 几秒可能就没了,一楼的先试试
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2758 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 12:24 · PVG 20:24 · LAX 05:24 · JFK 08:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.