Forum Discussion

doug_hays_9832's avatar
doug_hays_9832
Icon for Nimbostratus rankNimbostratus
Aug 17, 2006

Is This Way Correct?

I am trying to create an Irule that will include our current rate limiting that is working for connections but unfortunately is blocking some proxy caches we want to allow and limit those caches to 500kbps. I have modified the Irule below to allow the proxies through with a different rate limit class of their own in the added If-aol-return section below but the proxies still cannot get through.

 

 

Thanks for your help

 

 

priority 700

 

 

when RULE_INIT {

 

array set ::active_clients { }

 

}

 

when CLIENT_ACCEPTED {

 

if { [matchclass [IP::remote_addr] equals $::monhosts] } {

 

return

 

}

 

if { [matchclass [IP::remote_addr] equals $::aol] } {

 

rateclass rate_limit_500kbps} {

 

return

 

}

 

set client_ip [IP::remote_addr]

 

if { [info exists ::active_clients($client_ip)] } {

 

incr ::active_clients($client_ip)

 

if { $::active_clients($client_ip) > 250 } {

 

drop

 

} elseif { $::active_clients($client_ip) > 150 } {

 

rateclass rate_limit_400kbps

 

} elseif { $::active_clients($client_ip) > 100 } {

 

rateclass rate_limit_800kbps

 

} elseif { $::active_clients($client_ip) > 50 } {

 

rateclass rate_limit_1600kbps

 

}

 

} else {

 

set ::active_clients($client_ip) 1

 

}

 

}

 

when CLIENT_CLOSED {

 

if { [info exists ::active_clients($client_ip)] } {

 

incr ::active_clients($client_ip) -1

 

if { $::active_clients($client_ip) <= 0 } {

 

unset ::active_clients($client_ip)

 

}

 

}

 

}

 

3 Replies

  • This is the part that is not working...

     

     

    if { [matchclass [IP::remote_addr] equals $::aol] } {

     

    rateclass rate_limit_500kbps} {

     

    return

     

    }

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    When you say it's "not working" what do you mean?

     

     

    Is the matchclass not returning a postive match? Is the class not configured properly? Is the rateclass being called but not functioning the way you expect?

     

     

    Some more detail would be helpful.

     

     

    Colin
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    I'm a little baffled by the extra "} {" at the end of your rateclass statement. Perhaps you ought to remove that...