Forum Discussion

bboyjnr_8532's avatar
Nov 09, 2011

iRule to calculate client bandwidth usage

hi all,



Just wondered if there was a way to calculate user/client bandwidth per VS and then apply a rateclass when a limit is reached?



I think this can be done with an iRule but not sure where to start!



Help appreciated as always.




4 Replies

  • what is different with applying rate class to virtual server without calculation?
  • maybe i should have posed my question a little different and explain the situation...



    I have clients connecting to a VS to download files and once they have downloaded say 500mb of data then i need to shape the traffic down so for instance shape the traffic down for that perticular client so once they hit a download limit of 500mb then the bandwidth they are allowed is down to say 1mbit/s.



  • just wondering whether you have seen this one. would it be applicable?



    Simple traffic shaping by JackofallTrades







    [root@ve1023:Active] config b virtual bar list


    virtual bar {


    snat automap


    pool foo




    ip protocol tcp


    rules myrule




    [root@ve1023:Active] config b rule myrule list


    rule myrule {









    when SERVER_DATA {


    set srvAge [IP::stats age]


    set srvBytes [IP::stats bytes in]


    if {$srvAge > 10000 } {


    if {$srvBytes > 3000000 } {


    rateclass bandHog




    log local0. "Bandwidth Hog: [IP::client_addr] server bytes $srvBytes"
















    [root@ve1023:Active] config b rate class list


    rate class bandHog {


    rate 1Mbps


    ceiling 1Mbps


    drop policy tail


    type sfq





    [root@ve1023:Active] config tail -f /var/log/ltm


    Nov 9 05:53:41 local/tmm info tmm[4766]: Rule myrule : Bandwidth Hog: server bytes 137926996


  • thanks thats a great start for me to go on, will have a re-jig of the rule and see whati come up with :)