You will not be able to block all BitTorrent traffic with simple port rules. The document linked to by Cyclops3590 lists some common ports in use by some BitTorrent clients (6881-6999 TCP for the inter-client-communication
iptables -I FORWARD -p tcp -m mport --dport 6881:6999 -j DROP
-- though that's a rather wide range and may cause problems if you still want to connect to some IRC servers on nonstandard-ports, for instance.
This will not block all BitTorrent traffic, however. One of the most widely used trackers out there does not listen on port 6969, but port 80 -- and many other trackers have similarily generic or random ports. BitTorrent tracking over UDP is also supported widely.
Likewise for the inter-client communication -- different BitTorrent clients use different ports, some even pick a random port on installation or restart (the BitTorrent engine used by Blizzard games, for instance, listens on port 3724 TCP).
You can try to curtail the BitTorrent usage on unknown ports in a few ways, one of which being the module you do not want to use (which tries to match on the content of the packet, not the ports being used).
You could use the iptables string match on the first few packets of all TCP connections (together with connection tracking, this is possible -- although in a hacky way). This would, however, be slower than the aforementioned module. Something like
iptables -A FORWARD -p tcp -m string --string "BitTorrent protocol" -j DROP
is a bit heavy (it drops any TCP packet containing the words BitTorrent protocol -- which is the protocol handshake for inter-client communication and the first bit sent over a BitTorrent connection, but would work (and cause some problems if you were to want to view a webpage containing those words).
You could also try filtering on the tracker connectivity by looking for something like "event=started" inside a HTTP request, though modern BT clients do not strictly require a tracker, but can make do with a DHT instead -- which uses yet another protocol.
If you decide to match on the BitTorrent protocol string, be aware that certain BT clients now support encrypted communication to evade just that.
Depending on how technically savvy your users are, you might get away with just blocking ports orjust blocking BitTorrent protocol handshakes on certain portranges. If your users are hostile and technically adept, good luck -- nothing short of traffic-shaping and QoS rules will help you in that case.
Main Topics
Browse All Topics





by: Cyclops3590Posted on 2006-08-20 at 15:15:51ID: 17352714
looks like these are the ports he/25.html
http://btfaq.com/serve/cac
do you need the IPTables rules or do you know how to do that