Mikrotik P2P mangle rule – SOLVED

Its long time ago but MikroTik removed P2P matcher from mangle rule, so now you have to use L7 analyze to mangle this traffic.

Here is code to paste to the terminal:

/ip firewall layer7-protocol
add name=P2Pmatch regexp="^(\\x13bittorrent protocol|azver\\x01\$|get /scrape\\\
    \?info_hash=get /announce\\\?info_hash=|get /client/bitcomet/|GET /data\\\?f\
/ip firewall mangle
add action=mark-connection chain=prerouting layer7-protocol=P2Pmatch \
    new-connection-mark=P2Pconnection passthrough=yes

This mark P2P connection so you can apply queues on it, block it, or anything that you want to do with a connection 🙂