dogking2
V2EX  ›  问与答

开启 ip_forward 后如何限制来源 ip

  •  
  •   dogking2 · Oct 27, 2022 · 1572 views
    This topic created in 1375 days ago, the information mentioned may be changed or developed.
    尝试过用 iptables 限制来源,但是失败了

    B 配置:
    net.ipv4.ip_forward = 1
    iptables -I INPUT -s "C 的 ip" -j DROP

    C --> B --> A:
    1. C 可以到达 A ,rdp
    2. C 不可以到达 B ,ssh
    chengandc
        1
    chengandc  
       Oct 27, 2022
    Assuming that the server knows how to route a packet and that the firewall rules permit its transmission, the following flows represent the paths that will be traversed in different situations:

    Incoming packets destined for the local system: PREROUTING -> INPUT
    Incoming packets destined to another host: PREROUTING -> FORWARD -> POSTROUTING
    Locally generated packets: OUTPUT -> POSTROUTING

    在 forward 链里面 drop
    dogking2
        2
    dogking2  
    OP
       Oct 28, 2022
    @chengandc 感谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5527 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 08:35 · PVG 16:35 · LAX 01:35 · JFK 04:35
    ♥ Do have faith in what you're doing.