What's new

QOS and torrents

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

helomoto

Occasional Visitor
Hi,

My ac68U is running the latest merlin firmware(376.49_2) and I am trying to setup a QOS.

It does an OK job when prioritizing Team Fortress traffic, for example. However, ping goes up from 10ms to 50ms. Webpage loading seems ok whenever I saturate traffic on my local torrent box, but youtube seems to be really slow. Ok so I went and set all my traffic, that goes to my pc, to highest priority, but its still slow.

This is my speedtest before I turn on torrent box to saturate traffic.
4007033288.png


This is after.
4007126569.png


This is how my QOS is setup.

QOS.jpg


So my question is: why doesn't download test show at least 1.6 MB/s whenever I test with saturated link? Removing 2 file transfer rules for 80 and 443, makes absolutely no difference.
 
Last edited:
The ASUSWRT QoS does not do much (if anything) for throttle or prioritising downloads.

I have found that the DD-WRT QoS works for Throttling torrents (I use DD-WRT on my AC56U) for the Beta ARM builds (I also found out today due to an early ISP speed upgrade that the QoS in DD-WRT is very sensitive to upload and download speed settings (too high or low)).
 
It's not absolutely necessary to use Tomato or DD-WRT, it can be done from the command line in Merlin's firmware but you need to now some basic iptables commands.

For myself, I use the qos-start script to delete ASUS' tc rules and replace them with HFSC instead of HTB, also I add some custom rules that use source ports and source MACs, something that the GUI won't allow.
 
This is very interesting charlie2alpha. Could you please post a line about how you create source port rules? Thanks.
 
Ok, here's the scripts I am using to shape my upload bandwidth:

First the mangle part, /jffs/scripts/qos-start

The rules are set in reverse order since the command I use inserts rules above the 3rd existing rule in the mangles table. As you can see I use a combination of MAC and source ports to match the ports I set my torrent client to use for outbound communication plus the single listening port it listens for incoming communication. The rules set the connmark 0x5 to this kind of traffic corresponding to the lowest priority in the ASUS gui.

The second part gives priority to my ssh sessions on the same box, using a connmark of 0x1 which corresponds to the highest priority in the ASUS gui.

The third and final part just gives priority to some ICMP traffic, namely echo requests (ping replies).

The second script /jffs/scripts/tshape.sh is called at the end of the first one and setups the actualy piorities using the HFSC shaper instead of the HTB ASUS is using. It is more complicated to use but it avoids packet reordering which is a big plus for VoIP apps and even games.

At the start of the script the CEIL variable sets the upload bandwidth and below I am setting the nominal rates of each priority and directly below their upper limit, although this is not 100% correct, in HFSC terms it called the "link sharing" speed and it the bandwidth this class (priority) wants to be satisfied. I set as absolute limit in all classes the maximum, used only when nothing else needs it. As you can see, I do not use the MEDIUM prority at all in my own rules so I set it to the minimum possible. The default priority is the LOW, same as in the ASUS scripts.

The 1:60 class is something I copied from the ASUS scripts, not sure if it has any use. Note that my script has no download restrictions whatsoever, I am not interested in them but if one wants, they can copy the rules from ASUS own scripts, they reside in /tmp/qos and they are dynamically created every time you hit apply in the QOS screens of the GUI or when the qos service restarts.

To see the iptables mangle table, use the "iptables -t mangle -L -v" command. To see the priority rules, use the "tc -s -d class show dev ppp0" command. All these assume that you use a PPPoE connection, if you do not, substitute ppp0 for the WAN interface that you use in the DEV variable of the tcshape.sh script and in the previous command I gave to see the classes.
 
Last edited:
It is better to just set the bandwidth download and upload limits in the torrent client.
 
It is better to just set the bandwidth download and upload limits in the torrent client.

That's obvious, but it won't help you much on low speed lines, even if you put proper limits your gaming will still suffer from increased latencies. After all, when you have a lot of bandwidth you don't really need traffic shaping for a home network, but speaking for myself, with just 1Mbps upload in a ADSL2 line, I really need it!
 
It is better to just set the bandwidth download and upload limits in the torrent client.

I disagree, its much better approach to have control over bandwidth on a router
because you don't always have access to computers on your network and its better to let torrent box have full download speed when its not used by priority services.
 
when you prioritise something something else slows. So if you play a game which you prioritise and use half your internet bandwidth your pings will suffer in timing. This is natural but your ingame pings would be good.

If you want to have good pings (from command prompt) you should prioritise ICMP after your game and before other things.

Im not sure how well the QoS works for ASUS routers but i use ques,prioritisation and firewalls in mikrotik which works really well even for L2. One of the things ASUS advertises is that QoS is supposed to keep your game running smooth even when your torrent is downloading but i am not so sure how well they can do that.

From the looks of it you can set maximum and minimum. One way to control downloads which i am not sure you can do with the router is to control the upload request of it such as the number of packets per second, the que and even the amount of bandwidth they use.
 
Last edited:
If you are really hellbent on running QOS you would be better off running Tomatousb as the QOS is much better than the Asus QOS.
 
If you are really hellbent on running QOS you would be better off running Tomatousb as the QOS is much better than the Asus QOS.

Yea, I like tomatousb a lot more than I do asus-wrt. However, I need a feature that is coming to asus firmwares: Deep packet inspection. Also, people say that arm port of tomatousb is still in alpha stage.
 
I am not sure what the goal here is, download throttling or upload shaping? My script is aimed towards the second, as it will influence the first anyway if done right. In the first post you state that you want download of at least 1.6MB/s but the screenshots show 5MB/s ? Some typo? If you meant 1.6MB/s upload, then HTB will do that for you but with packet reordering and additional latency/jitter which will influence your gaming. HFSC is more gaming friendly but tough to configure right, it doesn't work with absolute priority but with real time latency. You basically tell it how many milliseconds should be the guaranteed time to traverse the link. The lower the number, the more priority will give but then it will penalize that class and give back bandwidth to the other classes for a while. The HFSC scheduler therefore takes into account behavior over time, you should test it with real usage, speedtests never gave me good results, only inconsistency.
 
I am not sure what the goal here is, download throttling or upload shaping? My script is aimed towards the second, as it will influence the first anyway if done right. In the first post you state that you want download of at least 1.6MB/s but the screenshots show 5MB/s ? Some typo? If you meant 1.6MB/s upload, then HTB will do that for you but with packet reordering and additional latency/jitter which will influence your gaming. HFSC is more gaming friendly but tough to configure right, it doesn't work with absolute priority but with real time latency. You basically tell it how many milliseconds should be the guaranteed time to traverse the link. The lower the number, the more priority will give but then it will penalize that class and give back bandwidth to the other classes for a while. The HFSC scheduler therefore takes into account behavior over time, you should test it with real usage, speedtests never gave me good results, only inconsistency.


My goal is to have torrents running at full speed, while at the same time make it possible for traffic like youtube, direct download, voip games to squeeze torrent traffic in such way that I wouldn't even notice that its running. I'll just leave it without QOS for now and limit torrents on the torrent box.

Btw, in your script I think you can do DEV=$(nvram get wan0_ifname) to make it more universal.

Here is my modification of your script in case you find some changes more useful.(I did try two of your files first with my wan dev and macs)

http://pastebin.com/ZznXNzn0

Notice I set the range from 1024 to 65535, because torrent can pretty much run on any of those ports, but its probably a bad idea if torrent is running on desktop pc, as this would limit all applications. However, mine is running on separate box, so it made sense for me.
 
I see, that is my goal to, just that the torrent client in case is on a box that runs other things too, it's a more generic linux box so I use the port range to catch specifically the torrent traffic.

Even with such scripts, you should never set the upload limit of the torrents to more than 80% of the available upload bandwidth. The rest is a matter of playing with the parameters, my script is not perfect and I continue to tweak the numbers, experimenting.

Your additions to the scripts are nice, some day when I will be really bored I may try to automate it even more, extracting parameters from the nvram, but first I need to find the balance that works best for me. HFSC is a step forward from HTB but so damn hard to understand!

EDIT: BTW, the command to set the DEV variable should probably be "nvram get wan0_gw_ifname", otherwise you'll always get eth0 even in the case PPPoE is used, like in my case!
 
Last edited:

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Top