Reclassify QOS rule according to time

Discussion in 'Tomato Firmware' started by samuarl, Jan 29, 2009.

  1. samuarl

    samuarl Addicted to LI Member

    I would like to be able to reclassify a QOS rule from medium to low depending on the current time. My ISP (Virgin media) sets bandwidth thresholds during the day so I would like p2p traffic to be low priority. In the evening when the bandwidth thresholds are removed I would like to be able to set p2p as medium priority.

    Are there any existing scripts that could do this? Thanks.
  2. mraneri

    mraneri Network Guru Member

    You want to change the limit, not the priority. The priority should really only come into effect when you're transmitting at full speed, and have contention for the bandwidth between services.

    Are you sure you can't control the bandwidth in your P2P app? or are you trying to control over a number of PC's you don't necessarily have control over?
  3. samuarl

    samuarl Addicted to LI Member

    Yes sorry for not making it clear, I live in a student house with 5 other people some of whom cannot grasp the concept that we get throttled for downloading too much during peak hours. So between 16:00 - 21:00 I would like to have p2p classified as class A for example, so I can throttle it Inbound. I'm not sure, but I get the impression this inbound throttling will not reduce the bandwidth used but simply the router will drop the packets but I hope this will then deter them from trying to download during those hours. Out of those hours I would then like it to be set to low, which is only throttled outbound.
  4. az2008

    az2008 Addicted to LI Member

    This thread has an example of changing the QoS rules based upon whether a certain network activity is occurring.

    You might be able to adapt that.

    Also, Tomato's inbound "QoS" (it's not really traffic shaping) will slow down acknowledgments and even drop packets which will cause a well-behaved sender to slow down. You can also cause the same thing to happen by having an outbound QoS rule that caps outbound p2p traffic. If your roommates can't send the acks (and such) associated with p2p, then the inbound side won't have to work as hard doing the same thing.

    I haven't done that. Just repeating what I've read others say.

  5. kardzzz

    kardzzz Addicted to LI Member

    If your P2P is set within lowest, you may want to put it in its own class using same values as lowest, then toggle the number for that class, else it'll affect all other traffic during the threshold interval.... anyway I think this should help:

    Put code like the following into your scheduler, once to set and once to reset after interval.

    service qos restart

    *If you get your NVRam dump from your 'debugging' link, then you'll see the values you currently use, then just modify the class you want. I think it reads highest through to Class E
    I hope it works for you!!
    I also use Tivolu's STM code and it works great.
  6. Toastman

    Toastman Super Moderator Staff Member Member

    kardzzz, that's a great idea for changing rules. Thanks!
  7. samuarl

    samuarl Addicted to LI Member

    Yeah that should work as you suggest kardzzz. I also use Tievolus STM code though and the problem with your suggestion is that should the code run in the scheduler to restore the QOS values after Virgin have restricted my bandwidth the QOS settings will be useless. I would like to allow for the possibility that I have been restricted and allow Tievou's STM code to manage QOS rates.

    Using the technique you described though I think is the right track. Looking at my NVRAM dump I can see the QOS rules:

    qos_orules=3<00:12:5A:93:BA:7D<-1<a<<0<<<0<Xbox>0<<-1<d<53<0<<0:2<0<DNS>0<<6<d<80,443<0<<0:512<1<WWW>0<<6<d<80,443<0<<512:<3<WWW (512K+)>0<<-1<d<53<0<<2:<4<DNS (2K+)>0<<-1<d<1024:65535<0<<<4<Bulk Traffic

    I'm not sure which but one of those numbers must specify which class the rule is (at the moment I think its the number before the rule name). By adding a scheduled task at the beginning and end of the traffic management period this should work I hope. The problem with this though is I will have to change the scheduled task code every time I change the rules.

    Will report back with results.
  8. kardzzz

    kardzzz Addicted to LI Member

    samuarl, what i did was take tivolu's script and host my own download file, changing the values to suit my needs. If you do the same, you can just add the 2 lines
    to set and unset those values during the STM period. If you can read the code in the file you can see where it sets and unsets.

    **My NVram has parameters qos_irates= & qos_orates=. Are you sure you have QoS enabled? The value appear in my NVram just before 'qos_orules'.
    I'm running 1.23.8500 Victek.
  9. samuarl

    samuarl Addicted to LI Member

    Your right it will work. The mistake I was making (rather foolishly) was that the STM monitor changed the qos_irates & qos_orates values, and should I have a scheduled task which also set them the two would conflict. When in fact the STM monitor obviously changes the max inbound and outbound bandwidth values. Thanks :)
  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