I understand the difference between prerouting, forward and postrouting chains in terms of the relative position they occupy in the flow of things
What I’m not sure about is which one to use and why
For instance, I setup mangling of VoIP traffic based on the remote Asterisk server’s IP
I first created prerouting mangling rules, and noticed that it wasn’t picking up many packets
When I switched over to forward chains things picked up considerably with regards to marked packets
I’ve seen some “fancy” configurations where a packet was marked in prerouting in order to run it through some queues, etc, and then the packet marks are changed in postrouting in order for other queues and firewall rules.
Indeed I use a postrouting mangle rule set to first set the packet priority from the DSCP value, and then the packet mark from the packet priority, to then use it in a queue tree to prioritize the packets when sending them.
In Linux routers configured natively it is possible to directly match the DSCP value in a queue tree, but I have not been able to do that in a MikroTik (no u32 match ip feature in Queues to match IP header fields), hence the workaround via mangle.
I know and this is all over the place, too - for instance in BGP:
weight: higher value = preferred
local-preference: higher value = preferred
metric: lower value = preferred
vrrp - higher value = higher priority
DSCP = throw darts at a dart board and then put the darts and dart board into a wood chipper
Cisco puts dot1p 5 into the priority queue by default, for instance.
Funny thing is, putting dot1p and dscp values into packets is about the same as stamping “fragile” on a box and sending it to the post office. If a mail carrier reads “fragile” and interprets this to mean “use as elephant trampoline” then - too bad for you, right?
In compiler construction, name mangling (also called name decoration) is a technique used to solve various problems caused by the need to resolve unique names for programming entities in many modern programming languages. I know this one. But i don t know about your answer. I am no experience in this filed.