DSCP QOS with HTB and PCQ?

Hi all,

up to now I have been running only a PCQ queue tree for each subnet to allow equal bandwidth sharing. I am looking to implement QOS and looking at this wiki entry http://wiki.mikrotik.com/wiki/DSCP_based_QoS_with_HTB it would be what I need but I would lose the PCQ element…

Anyone have any ideas how I can run both? Would this be as simple as changing the queue type at the parent or would that mess up the bandwidth allocation of the subtrees?

Thanks in advance, sterb.

What i have done is make my htb tree to shape traffic like so

0 name=“Uploads_Full” parent=global-total limit-at=0 priority=1 max-limit=1>
burst-limit=0 burst-threshold=0 burst-time=0s

1 name=“Downloads_Full” parent=global-total limit-at=0 priority=1
max-limit=3M burst-limit=0 burst-threshold=0 burst-time=0s

2 name=“DN_priority1” parent=Downloads_Full packet-mark=p1_down limit-at=2M
queue=downloads_pcq priority=1 max-limit=3M burst-limit=0
burst-threshold=0 burst-time=0s

3 name=“DN_priority2” parent=Downloads_Full packet-mark=p2_down
limit-at=768k queue=downloads_pcq priority=2 max-limit=3M burst-limit=0
burst-threshold=0 burst-time=0s

4 name=“DN_priority3” parent=Downloads_Full packet-mark=p3_down limit-at=0
queue=downloads_pcq priority=3 max-limit=0 burst-limit=0
burst-threshold=0 burst-time=0s

5 name=“DN_priority4” parent=Downloads_Full packet-mark=p4_down limit-at=0
queue=downloads_pcq priority=4 max-limit=0 burst-limit=0
burst-threshold=0 burst-time=0s


and then on a per customer basis used simple queues to set thier speeds.

1 ;;; example
name=“example” target-addresses=10.0.0.100/32 dst-address=0.0.0.0/0
interface=all parent=none direction=both priority=1
queue=default-small/default-small limit-at=0/0 max-limit=300k/1150k
burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s
total-queue=default-small

I suppose you could change the queue type to a pcq queue type and ip range for the desired effect.

The unofficial de-facto standard for learning QoS is Janis Megis’s MUM talks.
Here are the video and slides.

The basic theory he covers is apply a first pass of marking and prioritization using mangle pre-routing and global-in, then applying a second round of PCQ bandwidth shaping using Mangle Forward and Global-out / out-interface.

One issue I have found is when doing this on a NAT router, you can not use connection marking for the PCQ tracking. PCQ applied to the out-interface can not see the NAT’ed address, so you have to apply PCQ to Global-out instead. This means you have to mark ingress and egress packets independently rather than marking the connection as a whole and letting the out-interface determine which is which.

If you are not performing NAT on that router, just ignore global-out and use the example Janis posts. It is far cleaner and a fair bit faster.