DSCP based QoS

I’m trying to do a simple QoS implementation. I’ve read the wiki article http://wiki.mikrotik.com/wiki/DSCP_based_QoS_with_HTB and cobbled together a simplified version of BrotherDust’s suggested implementation.

The script successfully builds the firewall mangle and the queue tree. I can see data moving at the mangle, but nothing seems to be moving into or out of the queue tree.

#### Set Variables
#Set interface here to whatever is the WAN port
:local outboundInterface "ether1"
#Set bandwidth of the interface (suggest leaving at 0 = no limit)
:local interfaceBandwidth 0
#Set where in the chain the packets should be mangled
:local mangleChain postrouting

#### First Create the Firewall Mangle

# Zero (0) packets don't have any DSCP data in their header and will be low priority
/ip firewall mangle add action=mark-packet chain=postrouting comment=dscp.0 disabled=no \
dscp=0 new-packet-mark=dscp.0 passthrough=no

# 46 packets are maked as EF (Expedited Forwarding) this is standard practice for VOIP devices - high priority
/ip firewall mangle add action=mark-packet chain=postrouting comment=dscp.46 disabled=no \
dscp=46 new-packet-mark=dscp.46 passthrough=no

# 48 packets are routing data, how MikroTik marks its OSPF exchanges - highest priority
/ip firewall mangle add action=mark-packet chain=postrouting comment=dscp.48 disabled=no \
dscp=48 new-packet-mark=dscp.48 passthrough=no

# All other traffic will be normal priority
:for x from 1 to 45 do={/ip firewall mangle add action=mark-packet chain=postrouting \
comment=dscp.1-45 disabled=no dscp=$x new-packet-mark=dscp.other passthrough=no}
/ip firewall mangle add action=mark-packet chain=postrouting comment=dscp.47 disabled=no \
dscp=47 new-packet-mark=dscp.other passthrough=no
:for x from 49 to 63 do={/ip firewall mangle add action=mark-packet chain=postrouting \
comment=dscp.49-63 disabled=no dscp=$x new-packet-mark=dscp.other passthrough=no}

#### Set up the queue tree

# Add a base queue to the queue tree for the outbound interface
/queue tree add \
	max-limit=$interfaceBandwidth \
	name=Outbound \
	parent=$outboundInterface \
	priority=1

# Add the queue for the MikroTik's routing exchanges, set to highest priortiy
/queue tree add \
		name=MikroTikRouting \
		parent=Outbound \
		priority=1 \
		packet-mark=("dscp_48") \
		queue=ethernet-default

# Add the queue for VOIP traffic, set to high priority
/queue tree add \
		name=VOIP \
		parent=Outbound \
		priority=2 \
		packet-mark=("dscp_46") \
		queue=ethernet-default

# Add the queue for all other traffic, set to normal priority
/queue tree add \
		name=Other \
		parent=Outbound \
		priority=3 \
		packet-mark=("dscp_other") \
		queue=ethernet-default

# Add the queue packets without DSCP in the header, set to lowest priority
/queue tree add \
		name=noDSCP \
		parent=Outbound \
		priority=4 \
		packet-mark=("dscp_none") \
		queue=ethernet-default

What am I missing?

Any suggestions, improvements or comments are welcome.

Okay,

I figured out the primary problem. Tthe packet marking didn’t match between the mangle and the queues: “dscp.48” != “dscp_48”

It seems to be working now.

It’s an interesting experiment. I can see there are a lot of packets without any DSCP set at all. I also changed the priority of the “dscp.none” to match the “dscp.other” since I don’t see the point of making them any lower in priority, but I like being able to see how many packets aren’t actually using it.

I’m curious if anyone has had success using similar methods to prioritize Routing data and VOIP or if there are other, more preferable methods.

And any other thoughts or observations are welcome as well.