V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
dogking2
V2EX  ›  问与答

开启 ip_forward 后如何限制来源 ip

  •  
  •   dogking2 · 2022-10-27 17:13:08 +08:00 · 581 次点击
    这是一个创建于 540 天前的主题,其中的信息可能已经有所发展或是发生改变。
    尝试过用 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  
       2022-10-27 17:25:01 +08:00
    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
       2022-10-28 10:27:11 +08:00
    @chengandc 感谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2874 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 07:28 · PVG 15:28 · LAX 00:28 · JFK 03:28
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.