Mangle vs CoS for VOIP

Hey everyone

I’ve been using MikroTik routers for quite awhile now 3+ years. Love them, they’re my goto…

with that being said; I’ve always used Mangle rules/tags to create a Queue Tree for traffic shaping with pretty good success.

However, is there any added benefits or is it better to do CoS tagging for VOIP? A lot of the networks I manage and setup have VOIP…

Would CoS setting from Voip PBX, Switches and then from MikroTik be a more ‘solid’ or best solution?

Mangle marks only “lives” inside the router.

In combination with Queue Tree gives you the control to shape traffic leaving the router, and there is were your mangle/Queue Tree control ends.

CoS (hopefully) inside the actual packets, so setting it will be useful as other devices along the path will “hopefully” “respect” them, giving priority if they’re programmed to do so.

Understood

As I can build a Queue Tree to “shape” the traffic over the WAN link; to give VOIP bandwidth requirements depending on network environment.

in regards to DSCP > COS – I can set this at the VOIP PBX level and specify for SIP/RTP. Most managed Swithces I can also define this on the VLAN level as well.

So if specified at VOIP-PBX level and at Switch level this would aid in priority on local network traffic; correct? That the packets should get the priority over others?

Would i also ultimately need to further add the QinQ setup on MikroTik router; although seems more complicated than its worth? When I can just use Mangle and Queue Tree rules as I already do 100% of time

Or should I consider to further implement DSCP/COS at switch level for voice VLANS and also maintain the Mangle rules with the Queue tree setup for shaping?

Is all your network wired?

Or should I consider to further implement DSCP/COS at switch level for voice VLANS and also maintain the Mangle rules with the Queue tree setup for shaping?

That would be the complete setup, as the router only shapes what leaves it; if the switch is congested shaping will do nothing.

Being worth the effort or not will depend on your switch capacity and usage, are you experiencing problems now?

Great points!

I take care of an office with ~120 VOIP telephones on own voice VLAN. Sound quality is good, but at times it can sound a little ‘rough’ or seem as its degrading call quality over longer internal voice call. I can assume its network congestion/traffic across switches

this network has HP Procurves along with RB1100ahx2… (love them).

Could I assentially further along my mangle rule?

To add the MT value for DSCP/COS? Below is what I found on previous

so for sip_tos=ef (this would be for RTP ports 10000-10XXX,) - right? Or am I backwards.

MT value I change DSCP to 184

for SIP Traffic (ports 5060-5099, open on PBX)
sip_tos=cs5

and then I have to set the MT value?

Found MT values here: http://forum.mikrotik.com/t/tos/11202/1

Ok

So I have mangle rules to “mark” connection for the VOIP traffic and specific ports

/ip firewall mangle
add action=mark-connection chain=prerouting comment=VOIP_TRAFFIC dst-port=
5060-5099 new-connection-mark=VOIP protocol=udp
add action=mark-packet chain=prerouting connection-mark=VOIP dst-port=5060-5099
new-packet-mark=VOIP passthrough=no protocol=udp
add action=mark-connection chain=forward comment=“IP-PBX Traffic”
new-connection-mark=VOIP port=10000-10800 protocol=udp src-address-list=
“SIP PROVIDERS”
add action=mark-packet chain=forward connection-mark=VOIP new-packet-mark=VOIP
passthrough=no port=10000-10800 protocol=udp src-address-list=
“SIP PROVIDERS”


But I would have to create an additional Mangle rule that would “Change DSCP (ToS)”

Correct?

Can I just create a mangle rule after the current ones, which would just look for the already parked packets? and then on those marked packets it can Action=change dscp

This would be new for me.. I dont believe there is good documentation on this? Sorry for my ignorance.

First thing I’d do is checking the switches stats looking for frame errors, just in case a patch cord, switch ether port, or network port of any device has gone bad.

A neater, and best practice approach would be making the phones to actually set CoS/DSCP values in their traffic, guess you have a provisioning server, so deploying that could be done on a centralized manner on all phones.

Same goes for the PBX, if possible; if not at least you can mangle just by IP which would be less resource intensive (the more conditions, the higher computational expense).

Mangling/marking by that “big” range of ports is always going to be more expensive, even marking connections first, which is more optimized. See http://wiki.mikrotik.com/wiki/Manual:IP/Firewall/Mangle

Regarding marking, the approach would be:

1.- Mark connection
2.- Mark packet by previous connection mark (passthrough)
3.- Change packet DSCP by connection mark (passthrough=no)

However, after all this being said, why don’t you simply prioritize by VLAN? see http://wiki.mikrotik.com/wiki/Manual:WMM

(In any case you will still need to do QoS at the PE router for Internet traffic.)

Thank you for your insight and knowledge! noted! :slight_smile:

If you trust that the DSCP and COS values are correct on your network, you can just use those values in your router’s marking/queueing strategy, and not worry about udp / port number at all. That’s actually how the fields were designed.

if dscp=42 then high priority
if cos=5 then high priority
etc…

OFF topic? Take a look too in inteface’s flow control. In congested links can destroy your QoS strategy.