All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Beverley <andy@andybev.com>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Detecting p2p traffic
Date: Mon, 22 May 2006 06:39:50 +0000	[thread overview]
Message-ID: <44715CB6.2000006@andybev.com> (raw)
In-Reply-To: <20060508004307.qkuxq25v4occs4gk@www.simplelists.com>

Ryan Castellucci wrote:
> On 5/7/06, Andrew Beverley <andy@andybev.com> wrote:
>> After varying degrees of success with p2p detection modules, I
>> would like to write the following rules using iptables to reliably
>> identify p2p traffic:
>> 
>> 1. If a host on the network has 5 or more simutaneous tcp
>> connections to ports above 1024, mark all connections to ports 1024
>> and above as 60.
>> 
>> 2. If a host has received (or sent) UDP packets from 5 different 
>> hosts' ports above 1024 in a minute then classify all UDP traffic
>> to and from that host above port 1024 as 60.
>> 
>> Number 1 can almost be acheived using something similar to: 
>> iptables .. --dport 1024: -m connlimit --connlimit-above 5 -j MARK
>>  --set-mark 60
>> 
>> Unfortunately though it still leaves 5 connections slurping up
>> plenty of bandwidth.
>> 
>> I have no ideas for number 2.
>> 
>> Anybody any ideas?
> 
> Take a look at the 'recent' and 'set' stuff.  You can use it to
> create groups of 'naughty' users and match against those groups.
> Recent is probably better in this case.

I achieved most of this with 'set'. I create an iptree ipset list that 
times out after 60 seconds. If the above are detected then the user's IP 
address is added to the ipset, and any subsequent traffic from the user 
destined to or from ports above 1024 is marked at a lower priority.

The one thing I haven't managed yet is detecting many different UDP 
ports within a set time period. Instead I match on UDP traffic packets 
longer then 1000 bytes, which seems to work on the whole but I'd like to 
get it to detect on different port numbers as it is less likely to over 
match.

Andy

_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

  parent reply	other threads:[~2006-05-22  6:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-07 23:43 [LARTC] Detecting p2p traffic Andrew Beverley
2006-05-08 19:22 ` Jason Boxman
2006-05-22  6:26 ` Andrew Beverley
2006-05-22  6:39 ` Andrew Beverley [this message]
2006-05-22  6:42 ` Samuel Díaz García
2006-05-22 14:25 ` Luciano Ruete

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44715CB6.2000006@andybev.com \
    --to=andy@andybev.com \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.