Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
piero66
V2EX  ›  Linux

centos iptables

  •  
  •   piero66 · Sep 19, 2015 · 2712 views
    This topic created in 3898 days ago, the information mentioned may be changed or developed.

    centos iptable 有没有办法限制一个端口最多只能有 10 个 ip 访问,第 11 个 ip 会被直接 drop 。

    看到 iptable 有 connlimit 模块,但这个是限制连接数的,好像实现不了我上面的功能。因为我对每个 ip 的连接数没有要求。谢谢

    5 replies    2015-09-19 23:14:07 +08:00
    onemoo
        1
    onemoo  
       Sep 19, 2015
    使用 recent 模块
    piero66
        2
    piero66  
    OP
       Sep 19, 2015
    @onemoo recent 模块也是限制单 IP 连接数的吧,而不是限制 IP 数
    onemoo
        3
    onemoo  
       Sep 19, 2015
    recent 可以设置为限制所有 TCP 连接的 syn 总数。不过单个 ip 可能多次 syn ,所以确实不适合你的需求。
    我看到还有 iplimit 模块,似乎可以: http://www.netfilter.org/documentation/HOWTO/netfilter-extensions-HOWTO-3.html#ss3.5
    piero66
        4
    piero66  
    OP
       Sep 19, 2015
    @onemoo 感谢回复,研究了下这个模块, For example, let's limit the number of parallel HTTP connections made by a single IP address to 4 , 也是限制同一个 IP 的连接数的。不是限制 IP 数的。
    onemoo
        5
    onemoo  
       Sep 19, 2015
    This match will allow you to restrict the number of parallel TCP connections from a particular host or network.
    你可以试试应用在一个网域中,不过这样也不是你的需求...而且掩码不能设置为 0...
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4158 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 05:30 · PVG 13:30 · LAX 22:30 · JFK 01:30
    ♥ Do have faith in what you're doing.