Openwrt sqm prioritize a tcp port

As per the title, how can I do it with sqm? I read dozens of threads and still could not find anything related to it. I would like to prioritize only one single tcp port over all the others.

1 Like

Likely you will need to write your own qos script utilizing prio qdisc and custom filter for this purposes. See .qos files under /usr/lib/sqm/ for examples.

Thank you. I just saw some examples, on simple.qos I saw a line in which might help me to prioritize a single tcp port.

ipt -t mangle -A OUTPUT -p udp -m multiport --ports 123,53 -j DSCP --set-dscp-class AF42

I wonder what this line does to port 123 and 53?

With tin scheme diffserv3, not much. With diffserv4, class "AF42" packets will be enqueued to "video" tins.

See http://man7.org/linux/man-pages/man8/tc-cake.8.html#PRIORITY_QUEUE_PARAMETERS

Thanks. The more i read the more I understand however this will take a lot more time than I had anticipated. Is there another sqm similar program in which I can get to prioritize only one single tcp port over all the others?

qos-scripts/luci-app-qos should allow that.

Out of curiosity, what port do you need to prioritize and are the services you are after running on a dedicated machine or should run concurrently with other applications on the same computers?

this is a out-dated way of thinking and kind of the opposite of what sqm is intended to archive.

1 Like

from what I understand sqm is a necessity if somebody wants to minimize bufferbloat and from the tests I have done if you have a fixed internet speed plan, sqm does it pretty good. At moment I'm on lte and as It has a varied speed throughout the day, is hard to determine a fixed download and upload speed, at moment I set it much lower than I'm receiving.

Thanks very much, Its a custom port for blockchain applications.

In the end even luci-app-qos did not work out the way I wanted, my idea was no matter what kind of traffic goes through, priority port packets should go first and never suffer latency issues cause any bandwidth would go for them if it was required to, both luci-app-sqm and luci-app-qos do not do that, in the end even ports put on on luci-app-qos priority suffered. Also both seem to be similar, both need upload and download speed to minimize bufferbloat, the idea of prioritize ports do not work, its a shame cause I had a tp-link router and port priority would work flawless and I could keep internet at full speed, no limiting factor. Sadly tp-link does not have a worthy lte modem router for band 2 and band 4.

I believe that is called precedence, and there i s a mode in cake for an 8 tier precedence scheme. But I have not tested that myself, and you still need to mark the incoming and outgoing packets with the correct DSCP values.
Note that pure precedence schemes without bandwidth limits per priority tier can be easily abused and too much marked traffic can completely starve all lower tiers.

EDIT: it appears that cake's "precedence" mode actually does not implement strict precedence so this line of thought is theoretical only.

And there is the root of the challenge, wireless backhauls have the intrinsic problem of ever varying capacities (speed) and latencies depending on signal conditions and competition from peers.

You will definitely benefit from some level of traffic control to mitigate bloat, but as you discovered, the capacity settings need to be conservative relative to the max possible capacity of the link.

Interesting, precedence schemes, thanks, good to know the right name of the thing I want to do.

Well the idea here would be which one gets first at the modem root then if it has a higher priority then is sent first, what is happening here is that the priority is not being done correctly. Now I wonder why.

Well, precedence has starvation side effects so you need to be careful :wink:

1 Like

Well in theory it should have starvation only to those packets which is not priority. Priority packets should never have any starvation if maximum bandwidth at that exactly moment is not being used at full.

Hey, I wonder if you have found a way to do this?
I have a poor internet connection and because of that I don't get the max out of my speed