queue tree priorities

I have marked packets with:

 0   chain=prerouting action=mark-connection new-connection-mark=http_conn passthrough=yes dst-port=80 protocol=tcp 
 1   chain=prerouting action=mark-packet new-packet-mark=http passthrough=no connection-mark=http_conn 
 2   chain=prerouting action=mark-connection new-connection-mark=https_conn passthrough=yes dst-port=443 protocol=tcp 
 3   chain=prerouting action=mark-packet new-packet-mark=https passthrough=no connection-mark=https_conn 
 4   chain=prerouting action=mark-connection new-connection-mark=dns_conn passthrough=yes dst-port=53 protocol=udp 
 5   chain=prerouting action=mark-packet new-packet-mark=dns passthrough=no connection-mark=dns_conn 
... 
16   chain=prerouting action=mark-connection new-connection-mark=other_conn passthrough=yes 
17   chain=prerouting action=mark-packet new-packet-mark=other passthrough=no connection-mark=other_conn

Now, i want to prioritize marked traffic over other traffic. Some traffic should only have high priority with no limit, but some have to be low priority with limits. I have created queues in queue tree:

0   name="http" parent=ether5 packet-mark=http limit-at=0 queue=sfq priority=3 max-limit=0 burst-limit=0 burst-threshold=0 
     burst-time=0s 
 1   name="p2p-down" parent=ether5 packet-mark=p2p limit-at=0 queue=sfq priority=8 max-limit=256000 burst-limit=0 
     burst-threshold=0 burst-time=0s 
 2   name="dns" parent=ether5 packet-mark=dns limit-at=0 queue=sfq priority=1 max-limit=0 burst-limit=0 burst-threshold=0 
     burst-time=0s 
 3   name="other-down" parent=ether5 packet-mark=other limit-at=0 queue=default priority=5 max-limit=1024000 burst-limit=0 
     burst-threshold=0 burst-time=0s 
 4   name="other-up" parent=ether1 packet-mark=other limit-at=0 queue=default priority=5 max-limit=256000 burst-limit=0 
     burst-threshold=0 burst-time=0s 
 5   name="p2p-up" parent=ether1 packet-mark=p2p limit-at=0 queue=default priority=8 max-limit=128000 burst-limit=0 
     burst-threshold=0 burst-time=0s

The idea is:

  1. give highest priority to dns requests with no limit and priority 1
  2. give high priority to icmp traffic with priority 2 and no limits
  3. give high priority to http traffic with priority 3 and no limits
  4. give medium priority to other traffic and limit 1024kbits for download and 256 kbits for upload, for all users in LAN (priority 5 with limits)
  5. give low priority (priority 8 ) for p2p traffic with limits 256kbits UP and 128kbit down for all users in LAN
    There will be other priorities, but it’s only for this explanation.

The Eter 1 is my WAN interface and Ether5 is LAN interface. There is NAT and connection tracking.

My question is: what interfaces attach to taht queues? Is my configuration right or should i change something?

Maybe should i change all my queue tree and create one queue “download” and subqueues for this queue. The same for upload - create one queue “upload” and subqueues for all marked packets? But what priorities should have main queue “Download” and “Uload” ? 8 or 1 ?

Another question about this topisc is: should i mangle prerouting and postrouting or maybe prerouting is enough?

OK, i will try last time to ask. Maybe any guru from MT will give any answer. If it’s needed, i can pay, just tell that “it costs” and how much?

Your idea its ok but the interface to attach its the global-total. Because you want to prioritize the traffic trough the router and always put limits because if you don’t do the mkt thinks “ok no limits nothing to do…”