LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 613|回复: 3

问个问题。

[复制链接]
发表于 2005-6-23 22:25:40 | 显示全部楼层 |阅读模式
规定每个IP最多20个连接,最多10个有效TCP连接。
请问如何才能实现呢?谢谢!
发表于 2005-6-23 22:38:51 | 显示全部楼层
不好办,主要是iptables的conntrack模块中总是有很多早已断开的连接,无法精确控制。你可以试一试connlimit 模块,反正我是没有试验成功过。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-6-23 23:02:31 | 显示全部楼层
的确不太好办。可能需要iptables 的extensions。有时间再看看。
回复 支持 反对

使用道具 举报

发表于 2005-6-24 07:52:31 | 显示全部楼层
不知道这个怎样? pom-base里边的。


iptables connlimit match
Author: Gerd Knorr <kraxel@bytesex.org>
Status: ItWorksForMe[tm]

This adds an iptables match which allows you to restrict the
number of parallel TCP connections to a server per client IP address
(or address block).

Examples:

# allow 2 telnet connections per client host
iptables -p tcp --syn --dport 23 -m connlimit --connlimit-above 2 -j REJECT

# you can also match the other way around:
iptables -p tcp --syn --dport 23 -m connlimit ! --connlimit-above 2 -j ACCEPT

# limit the nr of parallel http requests to 16 per class C sized
# network (24 bit netmask)
iptables -p tcp --syn --dport 80 -m connlimit --connlimit-above 16 \
        --connlimit-mask 24 -j REJECT
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表