Torrent/P2P load balancing PBR - How to mark the traffic

Hi guys,

I have 2 WAN connections on my mikrotik and I would like to redirect all torrent and peer to peer traffic only on a second connection.

I saw this link and I would like to do something similar
http://wiki.mikrotik.com/wiki/Policy_Base_Routing

However how can I recognize and mark the torrent/peer-to-peer traffic?
Do you have any better idea for this?

Thanks!

Update:

Added this rule. but I can t see the counters increase

/ip firewall mangle
add action=mark-routing chain=prerouting comment=//–PBR_P2P log=yes new-routing-mark=P2P p2p=all-p2p

/ip firewall nat
add action=src-nat chain=srcnat comment=//–NAT_OFFLOAD_P2P log=yes routing-mark=P2P to-addresses=5.172.126.154

/ip route
add comment=//–OFFLOAD_P2P distance=1 gateway=5.172.126.153 routing-mark=P2P

Even I am searching for similar solution, IP > firewall >mangle doesn’t seem to detect the torrent traffic.

One possible solution would be to configure your OS to apply a DSCP marking on all packets originating from the bittorrent client process. Windows support this, I am not sure about others.

This way you can then catch all the bittorrent packets in mangle based on the DSCP value and route them however you want.


I use this method for many processes in windows that I need to have special policy routing that cannot be based on port or protocol. For example all traffic from Chrome should be routed via different gateway than Firefox. Both use ports 80/443, so without DSCP there’s no way to differentiate between the two browsers on the same PC.

Of course one major disadvantage is that you must configure the desktop PCs to do the marking per process (via group policy) . Though I think you can centrally manage that if you use active directory.