Mange Rule - Chain Prerouting vs Forward

Let say i have connection game online through port 5000-5500.
When i mark connection this UDP packet . Which chain is better ? (Prerouting vs Forward).


Ex1

/ip firewall mangle
add action=mark-connection chain=prerouting new-connection-mark=game passthrough=yes port=5000-5500 protocol=udp
add action=mark-packet chain=forward connection-mark=game new-packet-mark=packet_game passthrough=no

Ex2

/ip firewall mangle
add action=mark-connection chain=forward new-connection-mark=game passthrough=yes port=5000-5500 protocol=udp
add action=mark-packet chain=forward connection-mark=game new-packet-mark=packet_game passthrough=no

Ex3

/ip firewall mangle
add action=mark-connection chain=prerouting new-connection-mark=game passthrough=yes port=5000-5500 protocol=udp
add action=mark-packet chain=prerouting connection-mark=game new-packet-mark=packet_game passthrough=no

Ex4

/ip firewall mangle
add action=mark-connection chain=forward new-connection-mark=game passthrough=yes port=5000-5500 protocol=udp
add action=mark-packet chain=prerouting connection-mark=game new-packet-mark=packet_game passthrough=no

Which example is fastest ? I’m try to learn on wiki with Packet Flow Chains but don’t understand much. Sorry for my idiot question .

It depends on what you want to do further with marked connections? If you want to prioritize traffic take a look here: viewtopic.php?t=149111

I will priority 1 all packet game. And surfing web prirority 2 . Download priority 3.
So can you help me which example at #1 is the best for my opinion mark packet game ?

The thread he pointed to has all the information you need. The last entry was clear and simple for example.

I’m still curious about Chain Prerouting or Forward ?
Because i read so many thread ,
A few people prerouting,prerouting for 2 mangle rule, said it it best for router take all connection than forward.
A few people use forward,forward, said router will forward packet to queue it will slow than prerouting.
A few people use prerouting,forward said prerouting will capture mark connection first after that we don’t need prerouting to mark packet, just forward it will go faster to queue.
I don’t know which one is best for my game priority. So i must beg some help here to clarify my mind ? Please look at ex1,2,3,4 and help me choose the best for game . Thank you.

My recommendation is to avoid pre-routing until you have a deeper knowledge of MT coding.
Pre-routing can affect traffic you had no intention of messing with due to its non-discriminatory approach.

Bump

i tested many ways to do this but the best
Prorouting for mark connection
forward for packets

I tested with forward & forward, and found it is slower than prerouting & prerouting. prerouting will capture dns request to the gateway witch forward won’t .

Thats a good distinction to be aware of. Instead of two connection marking rules rules (one forward one input) for the same packet marking rule, instead you can have just one prerouting connection mark. Correct? Thanks

Regardless if you need to mangle your gaming ports, then its your gaming skills that is the problem. :wink: