Traffic priorization problem

Hello,
i’m breaking my head trying to figure out how to do a very very simple QoS priorization of traffic.
there are 3 selectors: HTTP, Games, P2P
i only want to priorize traffic, games priority 1, rest 8 and even more, P2P restricted to 128kbps upload
internal network is NATtes via masquerading.
i’ve done mangle rules for gaming and port 80, the rules are mark connection first, then use that mark to mark the packets. Mangle seems to work fine(albeit inverted). “juegos” is games

ROS is 3.17, RB450

add action=mark-connection chain=prerouting comment="" disabled=no dst-port=28960-28970 new-connection-mark=juegos passthrough=yes protocol=udp
add action=mark-packet chain=prerouting comment="" disabled=no dst-port=28960-28970 new-packet-mark=juegos passthrough=yes protocol=udp
add action=mark-connection chain=prerouting comment="" disabled=no new-connection-mark=http passthrough=yes protocol=tcp src-port=80
add action=mark-packet chain=prerouting comment="" connection-mark=http disabled=no new-packet-mark=http passthrough=yes
add action=mark-connection chain=prerouting comment="" disabled=no dst-port=3827 new-connection-mark=emule passthrough=yes protocol=tcp
add action=mark-packet chain=prerouting comment="" connection-mark=emule disabled=no new-packet-mark=emule passthrough=yes
add action=mark-connection chain=prerouting comment="" disabled=no new-connection-mark=http passthrough=yes protocol=tcp src-port=443
add action=mark-packet chain=prerouting comment="" connection-mark=http disabled=no new-packet-mark=http passthrough=yes
add action=mark-connection chain=prerouting comment="" disabled=no new-connection-mark=emule p2p=all-p2p passthrough=yes
add action=mark-packet chain=prerouting comment="" disabled=no new-packet-mark=emule p2p=all-p2p passthrough=yes

then i have the queues

#
/queue type
set default kind=pfifo name=default pfifo-limit=50
set ethernet-default kind=pfifo name=ethernet-default pfifo-limit=50
set wireless-default kind=sfq name=wireless-default sfq-allot=1514 sfq-perturb=5
set synchronous-default kind=red name=synchronous-default red-avg-packet=1000 red-burst=20 red-limit=60 red-max-threshold=50 red-min-threshold=10
set hotspot-default kind=sfq name=hotspot-default sfq-allot=1514 sfq-perturb=5
set default-small kind=pfifo name=default-small pfifo-limit=10
/queue simple
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" direction=both disabled=no dst-address=0.0.0.0/0 interface=all limit-at=0/0 \
    max-limit=0/0 name=Juegos packet-marks=juegos parent=none priority=1 queue=default-small/default-small total-queue=default-small
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" direction=both disabled=no dst-address=0.0.0.0/0 interface=all limit-at=\
    128000/0 max-limit=128000/0 name="emule y p2p" packet-marks=emule parent=none priority=8 queue=default-small/default-small total-queue=\
    default-small
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" direction=both disabled=no dst-address=0.0.0.0/0 interface=ciudad limit-at=0/0 \
    max-limit=0/0 name=queue1 packet-marks=http parent=none priority=8 queue=default-small/default total-queue=default
/queue interface
set internet queue=ethernet-default
set ether2 queue=ethernet-default
set ether3 queue=ethernet-default
set ether4 queue=ethernet-default
set ether5 queue=ethernet-default
set ciudad queue=default

The problem is that queues ain’t working, in the queue1(the http one) it’s only showing upload traffic(~29kbps for full download) and nothing in download.

Now the questions:

  1. this is a DSL line, 2.5mbps/256K, which queue type is more beneficial?
  2. in simple queues there is the “queue type” and then there’s another queue type in total per each rule, how do this types relate to each other and to the interface queue?

regards,
Guillermo

Note to mikrotik: The state of the official docuemntation is sad at best, it’s totally outdated, ROS is approaching 4.0 and 3.0 documentation hasn’t been touched in months, there are lots of obscure and undocumented(or poorly documented) features

Note to you: wrong, documentation is updated daily: http://wiki.mikrotik.com/wiki/Category:Manual

wrong about documentation point maybe,
but that was not the main point of my situation which i detailed prviously and which i haven’t resolved and it’s not working at all.

besides there’s weirdness in how it works, if i use one type of queue, it doesn’t show traffic at all, if i use small, it shows the same upload and download, if i choose to not use upload or download, the traffic gets reversed(all this while shaping nothing as the speeds don’t change and latencies keep sucking under heavy download)



What’s new in 3.12:

*) changed behaviour of simple queues - queues with no limit and type default-small
and no children actually do not get installed, as if there was no queue;

then what’s the point of the ros accepting them, mark it as invalid instead!

even so, the problem of duplicated inbound and outbound traffic is still there with other queues.


is it so hard to do what i need to?
prioritize small ACK packets, prioritize gaming traffic, depriorize P2P and large downloads with larger queues.
i don’t wnat to do any kind of BW control, only priorization.

In order to have control one must limit the bandwidth. To have control only your packet queue must be operative on the link and to avoid packet queue on the ISP equipment and bottleneck equipment you must limit the bandwidth between 62% to 99% depending on case. What’s your internet connection?

ADSL, 2.5mb down, 256K up
i don’t want to do BW control(or 99% as you say) because i need max speed in any given task, but the ability to game with ultra-low ping(as it where running alone) when using P2P and heavy downloading+uploading at the same time.
my current “home” router can do this more or less fine(when gaming, it fragments large packets into smaller ones, and drop upload+download speed for P2P and http/ftp) and maintains good ping, this RB should be able to do it even better(but alas, it’s not currently)

What is your home router, make, model, firmware, QoS settings? If it can do it, why not put it between the ADSL line and the MikroTik router? How are you sure it keeps low ping with fragmenting packets? Is it connected to the ADSL modem or is it the ADSL modem?

use ‘target-addresses’ property of your simple queues.

it’s a D-LINK gaming router, and i’ll never put it in between, what’s the point on doing that if i’m testing mikrotik for this matter, it’s a router connected to a modem, i’m sure because i monitor in-game lag and have transfer graphs for downloads.

chupaka: what do you mean exactly?, i don’t see that property at all

Clipboard02.gif
if you do not set ‘target-address’ or ‘interface’, then it’s not possible to define, what packets are upload and what are download

but what’s that target-address for?, i don’t have a defined target for each rule as they’re either to the internet or from any internal station

lol :slight_smile: target-address is probably the most important setting for queues. it means “what are you going to limit” ?

read some examples:
http://www.mikrotik.com/testdocs/ros/3.0/qos/queue_content.php#.6.1

Dude, some of those small little thingies (home routers) are using completely different TCP protocol (for example: TCP Vegas (A)) and I’m not sure (yet) but in RouterOS I think queue-type=RED does a similar thing. Is your gaming router with stock firmware? Can you telnet into it and issue these commands:

root@DD-WRT:~# cat /proc/sys/net/ipv4/tcp_vegas_cong_avoid
1
root@DD-WRT:~# cat /proc/sys/net/ipv4/tcp_westwood
0
root@DD-WRT:~# cat /proc/sys/net/ipv4/tcp_vegas_alpha
3
root@DD-WRT:~# cat /proc/sys/net/ipv4/tcp_vegas_beta
3
root@DD-WRT:~# cat /proc/sys/net/ipv4/tcp_vegas_gamma
2

In this example the returned codes are 1 0 3 3 and 2, and we need to look at the return codes in your case. If the first is 1 then there’s your explanation for gaming success. And there’s something for all the MikroTik pros to think about as well, especially the development team.

More on TCP Vegas:

http://www.google.com/search?q=TCP+Vegas
http://www.google.com/search?q=tcp+vegas+wrt+OR+tomato

And the part about queue type RED in the MT manual is for me to read. :slight_smile:

my home router doesn’t have telnet, it’s closed in that aspect, most likely based in that network processor ASIC with packet shaping(can’t remember the name now).

normis: like i’ve said, i want to priorize EVERYTHING, be it incoming and outgoing for ANY source/destination address, then what, should it put “0.0.0.0/0” in traget-address or build 100 different rules for each game server, client, network and you-name-it that i want to priorize?

besides, all examples in the manual are of bandwidth limiting/control, which are not applicable in my case

if you specifically want to use simple queues - yes, you have to do that

else - use Queue Trees with Mangle packet marks

it’s not practical as i can’t cover all hosts/destinations, a general rule must work for any dest

but aren’t queue trees more geared towards bandwidth control than priorization?

Hm im confused about mangle … What is the right way to mangle trafic?
I use this way:

add action=mark-packet chain=prerouting comment=www disabled=no in-interface=\
    adsl new-packet-mark=www_in passthrough=no protocol=tcp src-port=80
add action=mark-packet chain=postrouting comment="" disabled=no dst-port=80 \
    new-packet-mark=www_out out-interface=adsl passthrough=no protocol=tcp

etc …
and then in queue tree:

add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=500000 \
    max-limit=650000 name=upload_wan1 packet-mark="" parent=global-out \
    priority=4 queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=0 name=www_up packet-mark=www_out parent=upload_wan1 priority=2 \
    queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=\
    5000000 max-limit=6000000 name=download_wan1 packet-mark="" parent=\
    global-in priority=1 queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=0 name=www_down packet-mark=www_in parent=download_wan1 \
    priority=2 queue=ethernet-default

etc …
Is this is right way or I need to mark connection also?
And is chain prerouting and postrouting OK , or to use also input output?
Also does is need to specify interface in mangle (if not it will be used on all interfaces right)?

Right. See http://wiki.mikrotik.com/wiki/Packet_Flow to clear that input/output question.

Anyway you could use parent=ADSL instead of global-out.

And you can check this out: http://mum.mikrotik.com/presentations/US08/janism.pdf

And here are the links about queues I have collected: http://forum.mikrotik.com/t/tree-queues-and-traffic-priority/25135/3
http://forum.mikrotik.com/viewtopic.php?f=13&t=29211&start=0

OK i have simple queue … only one static for my server and dynamic which is create hotspot and pppoe server … so because queue-tree is aplyed before here is which I was done for now and it is look OK … now I will be test for few day and see is good … so far so good looks to me … tell one blind men :smiley:
What do you think guys ?
Here is mangle:

/ip firewall mangle
add action=mark-connection chain=forward comment=DNS disabled=no \
    new-connection-mark=dns_conn passthrough=yes protocol=udp src-port=53
add action=mark-packet chain=forward comment="" disabled=no new-packet-mark=\
    dns_packet passthrough=yes protocol=udp src-port=53
add action=mark-connection chain=output comment="" disabled=no \
    new-connection-mark=dns_conn-in passthrough=yes protocol=udp src-port=53
add action=mark-packet chain=output comment="" disabled=no new-packet-mark=\
    dns_packet-in passthrough=yes protocol=udp src-port=53
add action=mark-connection chain=forward comment=http disabled=no \
    new-connection-mark=http_conn passthrough=yes protocol=tcp src-port=80
add action=mark-packet chain=forward comment="" disabled=no new-packet-mark=\
    http_packet passthrough=yes protocol=tcp src-port=80
add action=mark-connection chain=output comment="" disabled=no \
    new-connection-mark=http_conn-in passthrough=yes protocol=tcp src-port=80
add action=mark-packet chain=output comment="" disabled=no new-packet-mark=\
    http_packet-in passthrough=yes protocol=tcp src-port=80
add action=mark-connection chain=forward comment=p2p disabled=no \
    new-connection-mark=p2p_conn p2p=all-p2p passthrough=yes
add action=mark-packet chain=forward comment="" disabled=no new-packet-mark=\
    p2p_packet p2p=all-p2p passthrough=yes
add action=mark-connection chain=output comment="" disabled=no \
    new-connection-mark=p2p_conn-in p2p=all-p2p passthrough=yes
add action=mark-packet chain=output comment="" disabled=no new-packet-mark=\
    p2p_packet-in p2p=all-p2p passthrough=yes
add action=mark-connection chain=forward comment=other disabled=no \
    new-connection-mark=other_conn passthrough=yes protocol=tcp
add action=mark-packet chain=forward comment="" disabled=no new-packet-mark=\
    other_packet passthrough=yes protocol=tcp
add action=mark-connection chain=output comment="" disabled=no \
    new-connection-mark=other_conn-in passthrough=yes protocol=tcp
add action=mark-packet chain=output comment="" disabled=no new-packet-mark=\
    other_packet-in passthrough=yes protocol=tcp

And here is my queue-tree :

/queue tree
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=500000 \
    max-limit=650000 name=upload_wan1 packet-mark="" parent=adsl priority=4 \
    queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=0 name=www_up packet-mark=http_packet-in parent=upload_wan1 \
    priority=2 queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=\
    4000000 max-limit=5000000 name=download_wan1 packet-mark="" parent=adsl \
    priority=1 queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=0 name=www_down packet-mark=http_packet parent=download_wan1 \
    priority=2 queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=0 name=dns_down packet-mark=dns_packet parent=download_wan1 \
    priority=1 queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=0 name=dns_up packet-mark=dns_packet-in parent=upload_wan1 \
    priority=1 queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=0 name=p2p_up packet-mark=p2p_packet-in parent=upload_wan1 \
    priority=7 queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=0 name=p2p_down packet-mark=p2p_packet parent=download_wan1 \
    priority=7 queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=0 name=other_up packet-mark=other_packet-in parent=upload_wan1 \
    priority=6 queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=0 name=other_down packet-mark=other_packet parent=download_wan1 \
    priority=6 queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=50000 \
    max-limit=70000 name=upload_wan2 packet-mark="" parent=reserv priority=4 \
    queue=ethernet-default
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=750000 \
    max-limit=1500000 name=download_wan2 packet-mark="" parent=reserv \
    priority=1 queue=ethernet-default