Pascal Hambourg wrote:
> Hello,
>
> Eric Tao a écrit :
>> The problem is some intranet users are using P2P software that consumes
>> lots of bandwidth. One way of lowing P2P traffic is to limit the number
>> of connections made from an intranet user to its peers.
>>
>> My question is:
>> Is it possible to use iptables to accomplish this on the router box?
>>
>> The iptables rules should count the number of connections made by a
>> certain intranet IP to an internet ip, if for a specific intranet ip the
>> number of its internet peers exceeds a certain value, no more new
>> connections from that intranet user is allowed.
>
> Check the "connlimit" match.
> Another approach could be to use traffic control, e.g. fair queuing to
> allocate bandwidth evenly among hosts.
connlimit doesn't fit the scenario at all in that it matches only
incoming connection to the server, not forwarded one.
>
>> I am looking into the recent match to see if it's fit this scenario.
>
> No. It counts packets, not active concurrent connections. Non concurrent
> consecutive connections would count as many connections.
tc relies on p2p match plugin. ipp2p is quite old and will miss quite a
lot of p2p packages upon my experience. I haven't tried layer7, but
pattern matching should be processor intensive. Limit the number of
peers would be a good alternative way to lower p2p traffic.
Thanks for the reply. More comments are welcome.
|