V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
samwang1027

如何监控容器网段 iptables 规则的修改源头

  •  
  •   samwang1027 · Oct 1, 2023 via iPhone · 1657 views
    This topic created in 953 days ago, the information mentioned may be changed or developed.

    碰到一个奇怪的现象,k8s 集群节点的 iptables 会自动添加 Forward 规则,给容器网段的 ip 禁用转发 ssh 22 端口和 mountd 20048 端口,手动删 iptables forward 规则,一会儿又自动加上了。
    因为是用负载均衡访问容器 http 请求的,端口是随机的,使用 20048 端口访问的 tcp 请求,会收不到 syn+ack 的响应,导致连接超时,丢包。
    查了下,没有开启 firewall-cmd ,看系统日志也查不出来 iptables 被谁调用了。有什么方式可以查到修改 Forward 规则的源头吗?

    3 replies    2023-10-01 17:36:22 +08:00
    pagxir
        1
    pagxir  
       Oct 1, 2023 via Android
    修改一下 iptables ,把父进程名给记录一下
    Monad
        2
    Monad  
       Oct 1, 2023
    内核版本允许的话考虑 eBPF 跟踪一下 Netfilter 相关的 kprobe/tracepoint 。
    xzysaber
        3
    xzysaber  
       Oct 1, 2023
    eBPF 可以考虑下。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3151 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 14:44 · PVG 22:44 · LAX 07:44 · JFK 10:44
    ♥ Do have faith in what you're doing.