Tomato QOS and uTorrent 1.7

Discussion in 'Tomato Firmware' started by monks1975, Apr 15, 2007.

  1. monks1975

    monks1975 LI Guru Member

    Anyone using utorrent 1.7 beta know anything about the new outgoing port setting and how I can set it up to improve QOS in Tomato? If anyone can give me some hints and perhaps a good rule classification they have been using- would be grateful.

  2. rcordorica

    rcordorica Network Guru Member

    Read the FAQ.

    But here are my own QOS settings that have been working well.

    Uncheck Prioritize ACK - With this on, file downloads or P2P traffic will flood your bandwidth because a lot of packets are ACK type. This triggers ACK packets to be "highest" priority, even if the ACK packet is caused by P2P traffic and defined to be "lowest" (not something I want). Order of precedence!

    Default Class Lowest
    - This is my catch all. I put all data that can't be classified into the Lowest bracket. Most of the time P2P traffic is responsible for causing "unclassified" data.

    Max Bandwidth - Set to my upper limit of 384K upload. Test your true speed.

    Highest - Mission critical bandwidth in this bracket. I give it a high guaranteed bandwidth of 90% with max of 100%. The rest of the classifications are given progressively less percentages of the bandwidth.

    Inbound Limit - Actually very important. My latency sensitive operations are highest, so no limit for them. But web browsing, aim, p2p, all have the potential to max out your inbound bandwidth (youtube for ex.), slowing down QOS for everyone. Having an inbound limit ensures that you always have "just enough" bandwidth to make DNS requests and receive them back. Some people argue against inbound limits because by design it drops those packets (and then needs to re-request them). But the trade off is IMHO worth it.

    Click image for full size:


    Highest - DNS first because this is always used to obtain IP addresses. My games come second because they are sensitive to latency (they are not bandwidth hogs however).

    Lowest - For P2P. I only have emule and bittorrent clients on my network, so I chose to separate them instead of assigning a simple "catch ALL p2p". Remember that QOS gets slower as your filter rules add up.

    Be sure to carefully choose which ports you prioritize! If you do a lot of "catch all" classifications, like port 1000-5000 for example, (1000 through 5000), you are bound to create P2P traffic that gets prioritized higher than it actually should. (since p2p traffic is often unpredictable when choosing ports).

    Since I use Lowest as default, if I forget to classify a commonly used port, it will unfortunately get it's upload halved and max inbound lowered. So just be aware of the type of traffic you have and prioritize accordingly.

    For battlefield2142 I closely monitored the ports I was using the most often while in a game. It was more tricky than most. But most other services like http or remote-desktop have well defined ports.

    Try not to use l7, it's slow and I haven't found a reason to need it. I also try to minimize the amount of classifications I have to minimize QOS latency.
  3. kop48

    kop48 Network Guru Member

    Unticking Prioritize ACK will be the single most important tweak bar going through and writing the tables like you've done.

    Like you said, a lot of P2P traffic stems from ACKs. Nice guide!
  4. monks1975

    monks1975 LI Guru Member

    That was an impressive guide rcordorica. Thanks!
  5. digitalgeek

    digitalgeek Network Guru Member

    the only addition or change I would make is to remove the specific rule for bittorrent and set lowest priority for all ports above 1024 and make it the last rule in the list. The ports above 1024 that need a priority will be caught and dealt with by the rules in the order they appear. Using uTorrent with encryption will mask it's identity to QOS...

  6. dolly_oops

    dolly_oops Network Guru Member

    I would say that you get your client to bind all outgoing traffic to a single port - then add an outgoing rule which matches on the source port. That would be the best way to match and control BitTorrent traffic - port numbers are too generic (and some connections will have a port number under 1024), while encrypted connections won't match the protocol filters.
  7. rcordorica

    rcordorica Network Guru Member

    Actually you make a great point. I could simply allow unclassified connections, i.e. P2P apps, fall off the end of the match list, and thus by default go into my lowest priority.. all without explicit prioritization. This even works with encrypted P2P since by design it can't be classified.

    Which should actually speed up QOS because i'll be getting rid of two slower filters. Thanks!

    Similarly, in your setup you shouldn't need the last catchall 1024-65535. Unless your default priority is not "lowest"
  8. digitalgeek

    digitalgeek Network Guru Member

    I actually have a default priority of low... not that I have any traffic that falls in this category... but you are correct in that you don't even need a rule, cause any traffic that doesn't have a specific rule would fall into your default class which would in effect do the same thing... everything important that needs priority will get bandwidth first and everything else will get whats left...
  9. larsrya8

    larsrya8 LI Guru Member

    I have my uTorrent bound to a single local port. Makes QOS fast, and I don't have to worry about it messing with my games and unclassified applications. Default class for me is Medium. Of course, this only works if everyone on your network wants bittorrent throttled by QOS...

    Edit: I did have trouble with remote bittorrent users that used port 80. The network slowed to a halt, since remote port 80 is classified as High. Moving the bittorrent rules to the top with strict ordering on fixed that.
  10. dolly_oops

    dolly_oops Network Guru Member

    You might be able to get your BitTorrent client to not to connect to peers using certain ports (you definitely can do that in Azureus) - you don't necessarily have to move the rules around. I'm not saying that's what you should do - I just thought it was worth mentioning it... :)
  11. rcordorica

    rcordorica Network Guru Member

    Thanks to this thread, and digitalgeek, here are my new QOS Outbound settings. I wanted to keep this thread updated because it should be a good guide for a lot of people.

    No more L7 or IPP2P filters, yeah! Which means the L7 and IPP2P modules aren't needed (saves memory too). If you read the Tomato log you'll see they automatically get unloaded.


    The Negatives:
    Since I am no longer explicitly classifying P2P traffic, it all gets put into the "unclassified" data list (my default Lowest priority). This one list inside the Conntrack table will now become larger, and thus slower to iterate through.

    However by design I want P2P data to go unclassified. Therefore it doesn't matter if it's slower because the rest of my Classified connections will be much faster.

    Basically, I've constructed a "whitelist" instead of a "blacklist." For my usage, this is much easier, since I have only a few clients and their internet connection usage is known. I can easily add any specific program to the whitelist.
  12. magnazan

    magnazan LI Guru Member

    A question which i've seen no real answer to and something that has come up when i've been setting up QOS recently with uTorrent.

    At present my incoming port for uTorrent is 50000 and my outgoing ports as specified in net.outgoing_port and net.outgoing_max_port is 40000 and 40030.

    I've done this so i can QOS p2p traffic specifically, however on my inbound rule do i use only ports 40000-40030 in my p2p rule or do i include 50000 as well? The reason i ask is that when checking the QOS graphs i see that in Bandwidth Distribution (Outbound) traffic under 'Lowest' (My default for unclassified) there is a lot of bandwidth used on port 50000 approximately 60% of the overall coupled with Class A (My default for p2p traffic) which is 30% makes for a total of 90% upload for torrents.

    Another issue is that i only have a 128kbps upload and if i include port 50000 into my p2p rule my torrent download speed suffers quite a bit.

    I'm trying to get a happy medium and would like to hear what people with 128kbps uploads have done - if anything.
  13. samov

    samov LI Guru Member

    People using Upnp might want to add 1900 and 5000 to highest.
  14. dsm1212

    dsm1212 LI Guru Member

    Aren't these entirely within the Lan?

    Which makes me ask a dumb question, will the QOS and bandwidth settings also apply to traffic just within the Lan? I was just thinking WAN when setting this up because there is so much Lan bandwidth, but I guess it might be beneficial on the lan to prioritize media traffic too.

  15. Kiwi8

    Kiwi8 LI Guru Member

    Sorry to dig up this old thread.

    I just want to say that if u are using uTorrent 1.7, it's better to tweak the Advanced options to make uTorrent use only a single port (or a specified range of ports) as outgoing ports. This will make it easier to come up with a QOS rule that will affect only the uTorrent traffic.

    The options to modify are:
    1) net.outgoing_port
    2) net.outgoing_max_port
  16. n808

    n808 LI Guru Member

    Due to Comcast PowerBoost (throttling connections after 7MB or so). See this FAQ, I wanted to
    1) Use the before throttling max as upload max (1200 kbps)
    2) Set default to Low or Medium
    3) Set Lowest to use Max 270 kbps
    4*) Specify a rule to classify utorrent connections as Lowest.

    *) This turned out to be complicated. The PP2P torrent filter in the first post does not work. I could not get Kiwi8's advice with the advanced options in the previous post to work either. uTorrent 1.7.6 seemed to ignore these settings. Any advice?

    To get something working I had to use a catch all ports 1024-65535 rule, and use only one computer for torrent, as well as add high priority rules specifically for services like Hamachi on this computer, to not get classified by the catch all rule.
  17. srouquette

    srouquette Network Guru Member

    In uTorrent, you can select the incoming port.
    Create a rule for this port, don't use L7-filter.
  18. n808

    n808 LI Guru Member

    Yes, the incoming port rule works for around 1/2 the connections.
  19. srouquette

    srouquette Network Guru Member

    the other connections are "unclassified" ?
    I read in this forum that it means these connections receive or send no datas, so no need to classify them.
  20. Kiwi8

    Kiwi8 LI Guru Member

    Did u close uTorrent and start it again? After changing the settings it is recommended to do that.
  21. Partizan

    Partizan Network Guru Member

    Thank you all for this thread. It helped me alot to understand QOS and I could finally get rid of cfosspeed on my machines. :)
  22. vasiloui

    vasiloui Addicted to LI Member

    what is your connection from your ISP?
  23. zoz2000

    zoz2000 Addicted to LI Member

    Check Prioritize ACK

    If someone uncheck Prioritize ACK the upload will slowdown the download because ACK pockets won't arrive in time.
    So I suggest to check Prioritize ACK like CFosSped(Cfos/Cfosspeed prioritize ACK packets too)
    First picture:

    After I bought my WRT54GL and updated the firmware to Tomato I uninstalled CFosSpeed:)
  24. way2quik

    way2quik Addicted to LI Member

    Hey guys, wonderful help here.
    But a question, I read somewhere that for QoS to actually work, we would have to disable "Protocol Encryption", is that correct? Or can I leave it as Enabled/Forced and also 'Allow incoming legacy connections' ?

    Also, I do not understand how the BT ports can sometimes go under Unclassified.
    Here is a screenshot of my outbound distribution and the Outbound/Inbound rate is pretty much identical to rcordorica.

  25. ciscokidinsf

    ciscokidinsf Guest

    QoS start-stop script?

    Hi all, I am looking for a script that would let me start and stop QoS at certain times to help with my Torrents. (I have Tomato 1.21 and uTorrent 1.7 running in my cheapo WRT54G) I've searched the threads but was unable to find it.

    I want a script that will enable QoS at 7:00am every morning and disable it at 9:30pm every night. So that my torrents get more download bandwidth. ( I have VOIP, so to make it work I have the 'Lowest' setting at 25% of bandwidth ; if I set it up any higher and calls were just plain bad) and a piss poor AT&T Yahoo DSL with an anemic 1.5MB connection (they promise 3MB, deliver half of that 90% of the time!)

    So, my knowledge of linux commands is poor so I'd imagine the script would be something like this:

    crond service qos start time 0700;
    crond service qos stop time 2330;

    Where in Tomato would I put these scripts? Here: Under Administration>Scripts>WAN Up? or somewhere else?
  26. kisenberg

    kisenberg LI Guru Member

    I had the problem, that eMule and uTorrent used different ephemeral source ports, so my QOS rules didn't work as I wanted. The solution is simple:

    1. Add a new IP-address to your network-adapter.
    2. Bind your eMule- and/or uTorrent-client to the new IP-address.
    3. Add a QOS-rule for the new "p2p"-IP-address and move it to the first position.
    4. Modify your port forwardings.

    So, it doesn't matter which ports your client uses.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice