Page 1 of 1

Torrent blocking working in y2020

Posted: Sun Jul 05, 2020 4:31 pm
by sakalsk
Block Bittorrent and P2P using latest MikroTik RouterOS 6.43.3
Mikrotik new version software stops blocking torrents and p2p with the error P2P matcher is obsolete please use layer7 matcher instead - MikroTik
Here are the new and revise configuration what is still working in year 2020 - steps that will block torrents and p2p traffic from mikrotik router:

In terminal:

/ip firewall layer7-protocol
add comment="Block Bit Torrent" name=layer7-bittorrent-exp regexp="^(\\x13bitt\
orrent protocol|azver\\x01\$|get /scrape\\\?info_hash=get /announce\\\?inf\
o_hash=|get /client/bitcomet/|GET /data\\\?fid=)|d1:ad2:id20:|\\x08'7P\\)[\
RP]"
/ip firewall filter
add action=add-src-to-address-list address-list=Torrent-Conn \
address-list-timeout=2m chain=forward layer7-protocol=\
layer7-bittorrent-exp src-address=192.168.2.0/24 src-address-list=\
!allow-bit
/ip firewall filter
add action=drop chain=forward dst-port=\
!0-1024,8291,5900,5800,3389,14147,5222,59905 protocol=tcp \
src-address-list=Torrent-Conn
/ip firewall filter
add action=drop chain=forward dst-port=\
!0-1024,8291,5900,5800,3389,14147,5222,59905 protocol=udp \
src-address-list=Torrent-Conn

Re: Torrent blocking working in y2020

Posted: Sun Jul 05, 2020 4:34 pm
by sakalsk
This future is not 100% working...

regarding my testing after 5 minutes of inactive torrent it find first seeder and that other and other... it will slow down downloaders but there is still possibility torrent will work.

Re: Torrent blocking working in y2020

Posted: Sun Jul 05, 2020 9:19 pm
by nithinkumar2000
Block Bittorrent and P2P using latest MikroTik RouterOS 6.43.3
Mikrotik new version software stops blocking torrents and p2p with the error P2P matcher is obsolete please use layer7 matcher instead - MikroTik
Here are the new and revise configuration what is still working in year 2020 - steps that will block torrents and p2p traffic from mikrotik router:

In terminal:

/ip firewall layer7-protocol
add comment="Block Bit Torrent" name=layer7-bittorrent-exp regexp="^(\\x13bitt\
orrent protocol|azver\\x01\$|get /scrape\\\?info_hash=get /announce\\\?inf\
o_hash=|get /client/bitcomet/|GET /data\\\?fid=)|d1:ad2:id20:|\\x08'7P\\)[\
RP]"
/ip firewall filter
add action=add-src-to-address-list address-list=Torrent-Conn \
address-list-timeout=2m chain=forward layer7-protocol=\
layer7-bittorrent-exp src-address=192.168.2.0/24 src-address-list=\
!allow-bit
/ip firewall filter
add action=drop chain=forward dst-port=\
!0-1024,8291,5900,5800,3389,14147,5222,59905 protocol=tcp \
src-address-list=Torrent-Conn
/ip firewall filter
add action=drop chain=forward dst-port=\
!0-1024,8291,5900,5800,3389,14147,5222,59905 protocol=udp \
src-address-list=Torrent-Conn
Anyone Else Tried This???

Re: Torrent blocking working in y2020

Posted: Sun Jul 05, 2020 11:51 pm
by sakalsk
Just try it on your own. It really helps but not for 100%

Re: Torrent blocking working in y2020

Posted: Mon Jul 06, 2020 2:45 am
by vecernik87
well, if it does not work 100% then it does not really help, don't you think? I mean - what difference it makes if the download takes bit more? Idea of blocking is, that NOTHING goes through.
If it still starts after a while, it likely means you missed some port or regexp part, which still gets through.

Re: Torrent blocking working in y2020

Posted: Mon Jul 06, 2020 8:10 am
by Jotne
Block Bittorrent and P2P using latest MikroTik RouterOS 6.43.3
This was posted 5 Juli 2020. 6.43.3 is very old and far far from latest Router OS (from 18.10.2018). Latest stable 6.47 and long term 6.45.9
I would not have used this old version due to lots of missing security patches.

Re: Torrent blocking working in y2020

Posted: Wed Sep 16, 2020 4:03 pm
by jeanmichaeltagui
Yes it's work in my RB2011

/ip firewall layer7-protocol
add comment="Block Bit Torrent" name=layer7-bittorrent-exp regexp="^(\\x13bitt\
orrent protocol|azver\\x01\$|get /scrape\\\?info_hash=get /announce\\\?inf\
o_hash=|get /client/bitcomet/|GET /data\\\?fid=)|d1:ad2:id20:|\\x08'7P\\)[\
RP]"

/ip firewall filter
add action=add-src-to-address-list address-list=Torrent-Conn \
address-list-timeout=2m chain=forward layer7-protocol=\
layer7-bittorrent-exp src-address=192.168.88.0/24 src-address-list=\
!allow-bit
add action=drop chain=forward dst-port=\
!0-1024,8291,5900,5800,3389,14147,5222,59905 protocol=tcp \
src-address-list=Torrent-Conn
add action=drop chain=forward dst-port=\
!0-1024,8291,5900,5800,3389,14147,5222,59905 protocol=udp \
src-address-list=Torrent-Conn

Re: Torrent blocking working in y2020

Posted: Mon Sep 21, 2020 1:16 pm
by Jotne
Im uTorrent
Options->Prefences->BitTorrent-Protocol Encryption set it to Enabled, then test if your rule still blocks it.

Re: Torrent blocking working in y2020

Posted: Tue Sep 29, 2020 3:12 pm
by jeanmichaeltagui
Im uTorrent
Options->Prefences->BitTorrent-Protocol Encryption set it to Enabled, then test if your rule still blocks it.
I don't know how but it is still blocking torrent after i enabled BitTorrent-Protocol Encryption.

Re: Torrent blocking working in y2020

Posted: Tue Sep 29, 2020 5:08 pm
by neutronlaser
Why would you want to do this?

Re: Torrent blocking working in y2020

Posted: Sat Oct 03, 2020 8:08 pm
by jeanmichaeltagui
Why would you want to do this?
Torrent is illegal where i live,,,,,, if i don't block it then our small ISP will be charge by the internet authority

Re: Torrent blocking working in y2020

Posted: Sat Oct 03, 2020 9:06 pm
by Jotne
So if the speed limit is 100 kph and I have a car that can run 200 kph, we need to close the road?
Torrent are not illegal, sharing copyright material are.
Closing one service just move user to another :)

Re: Torrent blocking working in y2020

Posted: Sat Oct 03, 2020 10:07 pm
by neutronlaser
Why would you want to do this?
Torrent is illegal where i live,,,,,, if i don't block it then our small ISP will be charge by the internet authority
Where do you live? I don't believe they are illegal.

Re: Torrent blocking working in y2020

Posted: Sun Oct 04, 2020 6:13 pm
by creatin
Try to use it in Germany :)

Re: Torrent blocking working in y2020

Posted: Sun Oct 04, 2020 6:18 pm
by neutronlaser
Eek I just read about Germany.

Re: Torrent blocking working in y2020

Posted: Mon Oct 05, 2020 1:46 pm
by mrz
The Torrent system on it's own is not illegal.
Downloading copyrighted content is illegal.

Re: Torrent blocking working in y2020

Posted: Mon Oct 05, 2020 2:26 pm
by CZFan
The Torrent system on it's own is not illegal.
Downloading copyrighted content is illegal.

This is my understanding also, read an article yesterday that in Germany, some law firms are not so ethical (who would have thought) and sending very threatening letters to people to pay up, and the normal Joe does not know better, so he pays. Case of big brother bullying little brother

Re: Torrent blocking working in y2020

Posted: Fri Oct 09, 2020 12:13 pm
by freemannnn
rules are working for me also. i try to download various torrents with qbittorrent and they dont start. "force encryption" is enabled in qbittorrent options.
just a small remark. in second rule you have to change subnet to match your setup. the photo is after one hour trying to download random torrents.
i am not sure if there are any Concequenses in apps like facetime,viber,whatsapp, tv boxes etc. further testing needed.

/ip firewall filter
add action=add-src-to-address-list address-list=Torrent-Conn \
address-list-timeout=2m chain=forward layer7-protocol=\
layer7-bittorrent-exp src-address=192.168.2.0/24 src-address-list=\
!allow-bit

Re: Torrent blocking working in y2020

Posted: Fri Oct 09, 2020 6:30 pm
by Jotne
If you go to some PitateBay proxy or other Torrent site they tell you to not download if you do not use a VPN, and with VPN your rules does not work at all.

Re: Torrent blocking working in y2020

Posted: Tue Oct 13, 2020 7:33 pm
by jeanmichaeltagui
rules are working for me also. i try to download various torrents with qbittorrent and they dont start. "force encryption" is enabled in qbittorrent options.
just a small remark. in second rule you have to change subnet to match your setup. the photo is after one hour trying to download random torrents.
i am not sure if there are any Concequenses in apps like facetime,viber,whatsapp, tv boxes etc. further testing needed.

/ip firewall filter
add action=add-src-to-address-list address-list=Torrent-Conn \
address-list-timeout=2m chain=forward layer7-protocol=\
layer7-bittorrent-exp src-address=192.168.2.0/24 src-address-list=\
!allow-bit
Yes there are consequences, after applying the rules, i have also notice that it affect whatsapp audio reception and speedtest websites is not working at all......i solved whatsapp issue but not speedtest!

Re: Torrent blocking working in y2020

Posted: Tue Oct 13, 2020 7:39 pm
by jeanmichaeltagui
rules are working for me also. i try to download various torrents with qbittorrent and they dont start. "force encryption" is enabled in qbittorrent options.
just a small remark. in second rule you have to change subnet to match your setup. the photo is after one hour trying to download random torrents.
i am not sure if there are any Concequenses in apps like facetime,viber,whatsapp, tv boxes etc. further testing needed.

/ip firewall filter
add action=add-src-to-address-list address-list=Torrent-Conn \
address-list-timeout=2m chain=forward layer7-protocol=\
layer7-bittorrent-exp src-address=192.168.2.0/24 src-address-list=\
!allow-bit
After disabling the firewall rules then torrent start seeding, i think it is working for now, !!!!!!! will get you updated when it fails.

Re: Torrent blocking working in y2020

Posted: Thu Apr 01, 2021 2:20 am
by zimkasongo
hi all regarding how to block torrent, I use the below

/ip firewall layer7-protocol
add comment="Block Bit Torrent" name=layer7-bittorrent-exp regexp="^(\\x13bittorrent protocol|azver\\x01\$|get /scrape\\\?info_hash=get /announce\\\?info_hash=|get /client/bitcomet/|GET /data\\\?fid=)|d1:ad2:id20:|\\x08'7P\\)[RP]"

/ip firewall mangle
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=local layer7-protocol=layer7-bittorrent-exp new-connection-mark=torrent_conn passthrough=yes
add action=mark-packet chain=prerouting connection-mark=torrent_conn layer7-protocol=layer7-bittorrent-exp new-packet-mark=torrent_packet passthrough=no

/ip firewall filter
add action=drop chain=forward dst-address-type=local packet-mark=torrent_packet
add action=drop chain=forward content=tracker
add action=drop chain=forward content=info_hash
add action=drop chain=forward content=annonce_peers
add action=drop chain=forward content=getpeers
add action=drop chain=forward content=torrent

it'is working 100%

Re: Torrent blocking working in y2020

Posted: Thu Apr 01, 2021 11:06 am
by Jotne
In uTorrent
Options->Prefences->BitTorrent-Protocol Encryption set it to Enabled, then test if your rule still blocks it.
It still blocks encrypted torrent as asked about above?

Re: Torrent blocking working in y2020

Posted: Sat Apr 10, 2021 8:48 pm
by callef
how can i use these rules to limit speed instead of blocking?

Re: Torrent blocking working in y2020

Posted: Sun Apr 11, 2021 11:46 am
by dad2312
hi all regarding how to block torrent, I use the below

/ip firewall layer7-protocol
add comment="Block Bit Torrent" name=layer7-bittorrent-exp regexp="^(\\x13bittorrent protocol|azver\\x01\$|get /scrape\\\?info_hash=get /announce\\\?info_hash=|get /client/bitcomet/|GET /data\\\?fid=)|d1:ad2:id20:|\\x08'7P\\)[RP]"

/ip firewall mangle
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=local layer7-protocol=layer7-bittorrent-exp new-connection-mark=torrent_conn passthrough=yes
add action=mark-packet chain=prerouting connection-mark=torrent_conn layer7-protocol=layer7-bittorrent-exp new-packet-mark=torrent_packet passthrough=no

/ip firewall filter
add action=drop chain=forward dst-address-type=local packet-mark=torrent_packet
add action=drop chain=forward content=tracker
add action=drop chain=forward content=info_hash
add action=drop chain=forward content=annonce_peers
add action=drop chain=forward content=getpeers
add action=drop chain=forward content=torrent

it'is working 100%
don't work for me with utorrent client

Re: Torrent blocking working in y2020

Posted: Sun Apr 11, 2021 12:27 pm
by Jotne
As long as the client uses encryption (that can be turned on for utorrent) this does not work.

Re: Torrent blocking working in y2020

Posted: Thu Jun 03, 2021 8:49 am
by b3h3m07h
I find this set of firewall rules and layer 7 works well with encrypted torrents. Tested with Deluge full encryption and Flud on Android full encryption.

/ip firewall layer7-protocol
add comment="Mikrotik Block Torrent" name=layer7-bittorrent-expp regexp="^(\\x13bittorrent protocol|azver\\x01\$|get /scrape\\\?info_hash=get /announce\\\?info_hash=|get /client/bitcomet/|GET /data\\\?fid=)|d1:ad2:id20:|\\x08'7P\\)[RP]"

/ip firewall filter
add action=jump chain=forward comment="Torrent Blocker" jump-target=forward-torrents-non-allowed-devices out-interface-list=WAN src-address-list=!torrents-allowed-devices
add action=add-src-to-address-list address-list=torrent-connections address-list-timeout=1w chain=forward-torrents-non-allowed-devices comment="Torrent Blocker" layer7-protocol=layer7-bittorrent-expp
add action=add-src-to-address-list address-list=torrent-connections address-list-timeout=1w chain=forward-torrents-non-allowed-devices comment="Torrent Blocker" content=tracker
add action=add-src-to-address-list address-list=torrent-connections address-list-timeout=1w chain=forward-torrents-non-allowed-devices comment="Torrent Blocker" content=info_hash
add action=add-src-to-address-list address-list=torrent-connections address-list-timeout=1w chain=forward-torrents-non-allowed-devices comment="Torrent Blocker" content=annonce_peers
add action=add-src-to-address-list address-list=torrent-connections address-list-timeout=1w chain=forward-torrents-non-allowed-devices comment="Torrent Blocker" content=getpeers
add action=add-src-to-address-list address-list=torrent-connections address-list-timeout=1w chain=forward-torrents-non-allowed-devices comment="Torrent Blocker" content=torrent
add action=return chain=forward-torrents-non-allowed-devices comment="Torrent Blocker"
add action=drop chain=forward comment="Torrent Blocker" dst-port=!53,80,443,110,143,993,995,465,587,8080,8291,3389 protocol=tcp src-address-list=torrent-connections
add action=drop chain=forward comment="Torrent Blocker" dst-port=!53,80,443,110,143,993,995,465,587,8080,8291,3389 protocol=udp src-address-list=torrent-connections

Make sure UPnP is not enabled on the the subnet you wish to block torrents or selectively enabled per IP.
I found that increasing the timeout on src-address-list entries helped alot as some torrent client apps did not trigger/reset the original 2m timeout on the address addition.

You can also add these rules above est-rel connections in addition to the others.

/ip firewall filter
add action=drop chain=forward comment="Torrent Blocker" dst-port=!53,80,443,110,143,993,995,465,587,8080,8291,3389 protocol=tcp src-address-list=torrent-connections
add action=drop chain=forward comment="Torrent Blocker" dst-port=!53,80,443,110,143,993,995,465,587,8080,8291,3389 protocol=udp src-address-list=torrent-connections

Helps to catch already running torrent connections.

Re: Torrent blocking working in y2020

Posted: Thu Jun 03, 2021 9:43 am
by memelchenkov
Why would you want to do this?
Torrent is illegal where i live,,,,,, if i don't block it then our small ISP will be charge by the internet authority
What's the problem? Pass the court order to the violator, he will pay the fine. Torrents are not illegal. Downloading/uploading copyrighted content is illegal. If you block torrents you will restrict the rights of honest users.
If you are small ISP it's your uplink headache, why bother and why spend resources on it.

Re: Torrent blocking working in y2020

Posted: Fri Jul 30, 2021 12:01 am
by Machello
You need to set up Mangle bandwidth control properly and then you can successfully block torrents:

https://www.youtube.com/watch?v=ZK582jEdgIM
https://www.youtube.com/watch?v=B_Jig1RNY40
https://www.youtube.com/watch?v=RUGzdxBSmTU

I put p2p mangle connections and packets marks above http and other connection and packet marks so it gets filtered out first.
A lot of traffic used by BitTorrent can pass thru as other connection/packet marks that is not p2p/layer 7/http. It can still bypass your layer 7 filter rules as a utp connection so you have to drop connection of the client that is not http/layer 7/p2p. The block needs to time out after a while so that those other connections can be unblocked on the client.

Re: Torrent blocking working in y2020

Posted: Fri Jul 30, 2021 10:38 am
by DarkNate


Torrent is illegal where i live,,,,,, if i don't block it then our small ISP will be charge by the internet authority
What's the problem? Pass the court order to the violator, he will pay the fine. Torrents are not illegal. Downloading/uploading copyrighted content is illegal. If you block torrents you will restrict the rights of honest users.
If you are small ISP it's your uplink headache, why bother and why spend resources on it.
I fail to understand these local ISPs who first of all has zero certified network engineers and second of all has some strange obsession for torrent blocking which makes no sense in the age of encryption. Aren't they capping bandwidth per customer using simple queues or what?

Re: Torrent blocking working in y2020

Posted: Fri Jul 30, 2021 10:43 am
by rextended
It's a ovebooking problem for some ISP...
Have a 50Mbps and try to sell 10Mbps to 100 users...
When 5 of 100 users use torrents, the uplink is full and all users complain...

Also, using NOT WELL CONFIGURED torrent, can cause more incoming packet on gateway than the client have the right to use
and
the client try to transmit on upload more than what pay for, and the traffic reduce bandwidth available on radio link for other users
because the queue are on Gateway and not on CPE.

Re: Torrent blocking working in y2020

Posted: Fri Jul 30, 2021 1:56 pm
by Cablenut9
Have a 50Mbps and try to sell 10Mbps to 100 users...
When 5 of 100 users use torrents, the uplink is full and all users complain...
Then you need to upgrade, because the customers are using what they're paying for.

Re: Torrent blocking working in y2020

Posted: Fri Jul 30, 2021 2:27 pm
by rextended
Why wait for the update? Better service (for everyone) is good publicity and drives more customers ...

Re: Torrent blocking working in y2020

Posted: Fri Jul 30, 2021 2:28 pm
by Cablenut9
You can also use a VPN which is even harder to block, if you're using SSTP or Wireguard.

Re: Torrent blocking working in y2020

Posted: Fri Jul 30, 2021 2:53 pm
by pe1chl
It is the usual thing with these rules. It is not difficult to make a rule that blocks all Torrent traffic. What is difficult is making a rule that blocks all Torrent traffic but not anything else.
When I see those L7 rules above I'm sure it blocks all kinds of unrelated traffic and not all Torrent traffic. Which is exactly what the complaints are about.