Sunday 17 February 2013

IPTABLES TO BLOCK TORRENT

## IPTABLES TO BLOCK TORRENT (working correctly)
iptables -A INPUT -m string --string "BitTorrent" --algo bm --to 65535 -j DROP

iptables -A INPUT -m string --string "BitTorrent protocol" --algo bm --to 65535 -j DROP 

iptables -A INPUT -m string --string "peer_id=" --algo bm --to 65535 -j DROP 

iptables -A INPUT -m string --string ".torrent" --algo bm --to 65535 -j DROP

iptables -A INPUT -m string --string "announce.php?passkey=" --algo bm --to 65535 -j DROP

iptables -A INPUT -m string --string "torrent" --algo bm --to 65535 -j DROP

iptables -A INPUT -m string --string "announce" --algo bm --to 65535 -j DROP 

iptables -A INPUT -m string --string "info_hash" --algo bm --to 65535 -j DROP

iptables -A INPUT -m string --string "peer_id" --algo kmp --to 65535 -j DROP 

iptables -A INPUT -m string --string "BitTorrent" --algo kmp --to 65535 -j DROP 

iptables -A INPUT -m string --string "BitTorrent protocol" --algo kmp --to 65535 -j DROP

iptables -A INPUT -m string --string "bittorrent-announce" --algo kmp --to 65535 -j DROP 

iptables -A INPUT -m string --string "announce.php?passkey=" --algo kmp --to 65535 -j DROP

iptables -A INPUT -m string --string "find_node" --algo kmp --to 65535 -j DROP 

iptables -A INPUT -m string --string "info_hash" --algo kmp --to 65535 -j DROP 

iptables -A INPUT -m string --string "get_peers" --algo kmp --to 65535 -j DROP

iptables -A INPUT -m string --string "announce" --algo kmp --to 65535 -j DROP 

iptables -A INPUT -m string --string "announce_peers" --algo kmp --to 65535 -j DROP

15 comments:

  1. hi. Thanks for your post. I am new to ubuntu. Can the following rules be used on ubuntu server 12.04? how can i implement them. Thanks

    ReplyDelete
    Replies
    1. yes you can use it in any version of Linux.

      Delete
    2. You can implement them by running the command as for example sudo iptables -A INPUT -m string --string "BitTorrent" --algo bm --to 65535 -j DROP

      Delete
  2. hi. Does this block torrents 100% or does it just slow them down?

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. sorry don't work...test in my centos 6.7 x64..

    ReplyDelete
    Replies
    1. how to deployed it? if iptables is running with these rules and all traffic of source machines are passing through this machine then it will block p2p traffic 100%

      Delete
  5. Hi,

    It doesn't block the seed the torrent

    ReplyDelete
    Replies
    1. @Usman
      if you routed all your traffic to this proxy machine and iptables is running with these rules then it blocks p2p traffic 100%
      you can check it by using 'tcpdump -i eth0' by grepping above mentioned p2p strings.

      Delete
  6. How can you claim that this solution is 100%? How it will stop torrents traffic on HTTPS?

    ReplyDelete
  7. If you are wondering how to hide IP address when downloading a torrent, top choice should be via best VPN for torrenting. There are multiple other options when it comes to hiding your torrenting activity, but a VPN is by far the most convenient and easiest to set up.

    ReplyDelete
  8. Umm, looks quite interesting thread. As we all know that there are 1000's of other things we can do to block IP address but I personally think VPN is one of the best so far. Plus, vpn with cheap torrent services is great. well, good luck! x

    ReplyDelete
  9. I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! yggtorrent

    ReplyDelete