Dynamic Inbound QOS possible?

Discussion in 'Tomato Firmware' started by tomatouser, Jun 23, 2007.

  1. tomatouser

    tomatouser LI Guru Member

    Hi guys,

    I run tomato 1.07 on a WHR-G54S

    I basically would like to do inbound traffic shaping, i want my torrents to utilise the maximum bandwidth that i have in the inbound direction and then automatically slow down when router detects VoIP traffic from my ATA..and then when the VoIP traffic stops to give full bandwidth to the torrents again.

    I know inbound traffic shaping depends on ISP and its not completely effective to implement it at router level..but still can somebody please provide some idea if it can be done?

    PS i have already read the threads on qos in this forum and according to them what i am trying to do seems impossible :confused:
  2. GeeTek

    GeeTek Guest

    Huh ? Impossible ? What you are asking for is exactly what it does. There is a few second delay in getting the torrent to slow down, but that would only affect the "Hello" part of the conversation. Just give your VOIP traffic rule 100% bandwidth in both directions (VOIP only consumes what it needs), use strict rule ordering and put the VOIP rule higher on the list than any p2p rules you may have. Actually make it your VOIP rule the first rule above all others for best VOIP operation.
  3. tomatouser

    tomatouser LI Guru Member

    Tomato slows down the torrent upload to make way for VoIP traffic..but torrent download does not slow down (inbound direction) and when i do a echo test i get choppy audio.

    here are my settings




    I live in a country where Broadband is still in a nascent stage hence the 256 K speed

    I have given lowest in inbound direction 95 % of bandwidth coz i want torrents to work at maximum bandwidth when there are no VoIP calls. If i cap it then torrent continues downloading at reduced speed without ever touching the maximum..

    I would like to reiterate that its only inbound qos that a iam after...tomato handles outgoing Qos quite well. Please feel free to make suggestions to alter the settings as iam a complete newbie as far as QOS is concerned
  4. GeeTek

    GeeTek Guest

    You deleted one of the default rules which is critical for proper torrent control. This one ;

    Dst Port: 1024-65535 Medium non-essential services

    Put that back in at the bottom of your stack and set it to use your lowest priority parameter. Then set class "A" for 100% each way (outbound is 100% / 100%, inbound 100%) and assign the VOIP rule to class A. The router will not even touch (throttle) the VOIP packets if they are set for 100%. Also drop your highest and high inbounds to 92 or 93. You will not notice that much drop in speed, but it gives more margin under the VOIP traffic and will make it easier to regulate non VOIP traffic. Drop the outbound MAX on the lowest category to about 80 or 85, 96% is too much of your percentage. This will help the QOS system a lot for your VOIP usage. You do not need that much for outbound torrent. Also there is a script available to limit the torrent connection count which helps to keep the router from getting swamped. Lowering some of the time out values in conntrack helps overall performance in high torrent environments.
  5. tomatouser

    tomatouser LI Guru Member

    ok i have done everything that u have mentioned..stituation seems to have improved somewhat..but i am still getting choppy audio..also there is a 2 second lag in hte voice conversation..that is wherever i say something the other party hears it after a gap of abt 2 secs..

    Perhaps, the torrent client is opening too many connex's..can u pls direct me to the script and how to use it..Thanks..
  6. digitalgeek

    digitalgeek Network Guru Member

    I would recommend using the mac address of you Voip device, not the IP (although this is not your specific problem)...

    as well you have your highest classifaction set to you 98% and 97%. You should set these back to 100%
  7. tomatouser

    tomatouser LI Guru Member

    ok..i have two questions can u pls answer them?

    Suppose i set inbound bandwidth to 90 % for lowest class and assign torrents to that class and i put Voip as class A with 100 % bandwidth (both inbound and outbound) & highest priority...will the router drop torrent traffic in favour of VoIP traffic in the inbound direction?

    What is this KB transferred setting? should i be using it ?
    alll i found in readme is this "KB transferred match: (1) This is the to-WAN data transferred in kilobytes. Consider the amount an approximate value since it doesn't take into account protocol overhead. (2) Entering an upper limit of 1GB (1,048,576KB) or more is considered unlimited and will match anything above 1GB. (3) IPP2P may not work properly with this since IPP2P doesn't keep track of its state.:" cant really comprehend that..:confused:
  8. GeeTek

    GeeTek Guest

    Can you test the VOIP with no torrent traffic at all to see if the choppy audio and 2 second delay go away ? The delay does not sound like it is QOS related. Here is the script to limit connection counts ;

    iptables -I FORWARD -p tcp --syn -m iprange --src-range -m connlimit --connlimit-above 105 -j DROP

    I put mine into "Advanced - Scripts", all 4 categories because the first time I tried it in the firewall section (where it is supposed to go) it did not seem to work. Copy and paste, and then save. You can fix the IP range to match your setup, and the limit of 105 may be a bit strict for you. In "Advanced - ConnTrack" I would start by reducing every single value by 50%. I have a few radios set for a lot less than 50% on some of those higher values. As much as I value DigitalGeeks opinion on setting the high and highest back to 100%, I'm not so sure I agree. DNS traffic can be quite significant as can a large website load, and those 2 being at 100% would put a lot of traffic including web browsing in the same category as your VOIP, less the rule order. I would feel better with some margin for the VOIP. Just my thoughts, mileage may vary.
  9. GeeTek

    GeeTek Guest

    I don't know if the inbound speed control mechanism is dropping some packets or delaying their replies. Either way, it works, and will favor the VOIP packets by the relative percentages.

    The KB transfer match is a trigger point for amount traffic in the rule you create. This can be used to control traffic that is normally in a high category but has become overly motivated, such as torrent systems or Virii that use port 80 to evade detection and will bypass the normal QOS rules. (I think that is what it is........)
  10. tomatouser

    tomatouser LI Guru Member

    Its a Qos issue definitely but not at router level particularly in inbound direction. If i shut down all other traffic i get crystal clear audio without any lags.

    With all due respect to ur opinion i feel that QOS for inbound direction has very limited effectiveness.

    I am no networking geek but my logic says that i can control and prioritise only the traffic that i send from my router but the traffic coming into my router (inbound) depends on my ISP. If my ISP doesnt give priority to VoIP traffic and sends torrent/or any other data before VoIP packets..there's very little that the router can do?
  11. GeeTek

    GeeTek Guest

    Yer gonna make me start repeating myself here aren't you. Here goes.
    Your router can 1 - Drop inbound packets, 2 - Selectively delay the ACK to certian types of packets as you have defined by the rules. Both mechanisms will have the same effect, the sending server will slow down the speed of their transmissions to you.
    As far as your networking "feelings" on inbound qos go, you could always do a little more testing and a little less asking. In the amount of time it took you to post the question you could have entered 10% into the torrent download value, hit save, checked the pie chart to be sure it was in the 10% category and then opened the speed chart to see what happened. Try it !!! I've spent literally hundreds of hours fine tuning Tomato QOS control in live environments, so I do not need to ask or wonder about the effectiveness of inbound QOS. I've seen it with my own eyes, and it is pin-point accurate when you get the rules to properly recognize the traffic in question.
  12. tomatouser

    tomatouser LI Guru Member

    Dude i have been at it whole day today..n i only asked when i didnt get something..i made all the changes that u suggested..yet to see a marked improvement.. therefore that remark..nywayz it was only a question and not an assertion and i believe forums are for asking questions..
  13. Hypernova

    Hypernova LI Guru Member

    Delaying return ACK would pretty much cover most traffic wouldn't it? consider most none real time traffic uses TCP. No point trying to limit real time stuff that has arrived using up bandwidth already.
  14. azeari

    azeari LI Guru Member

    i'd like to add that inbound qos is rather limited in functionality despite the delaying ACK packets arguement, as seen by tomatouser's experience.

    Some possible solutions to the problems you're facing:
    1. the few second lag
    This is a latency issue(nothing to do with bandwidth), that occurs when isps throttle their clients to limit the incoming and outgoing packets.

    Solution will probably be to lower your max outgoing even further to something like 200kbps. No guarantees here though

    2. Choppy Audio
    Problem here as mentioned is probably the limitations of incoming qos, though i feel the blame might lie partly with the throttling of packets by the isp too.

    Not much you can do here besides lowering the max incoming and outgoing for your lowest level even further and setting the conn limitations stated earlier.

    It is possible to write a shell script to ping a remote host every few seconds and adjust the qos rules accordingly. That might just do the trick. Also, if your voip device/software supports it, you could further bump the compression levels to work with your limited bandwidth.

    please take note that 256kbps IS rather difficult to shape with qos. (= goodluck experimenting
  15. tomatouser

    tomatouser LI Guru Member

    I think u have hit the nail on the head there.

    Qos is really difficult to implement with limited bandwidth. Its much easier on my 2 Mbps line.
  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