Forum Discussion
JRahm
Nov 14, 2006Admin
Perhaps the easiest way would be to establish an active connection count via an iRule on the virtual hosting the data path:
when RULE_INIT {
array set ::active_clients { }
}
when CLIENT_ACCEPTED {
if { [info exists ::active_clients([IP::client_addr])] } {
incr ::active_clients([IP::client_addr])
} else {
set ::active_clients([IP::client_addr]) 1
}
}
when CLIENT_CLOSED {
if { [info exists ::active_clients([IP::client_addr])] } {
incr ::active_clients([IP::client_addr]) -1
if { $::active_clients([IP::client_addr]) <= 0 } {
unset ::active_clients([IP::client_addr])
}
}
}
Then applying a limit via an iRule on the initial virtual:
when CLIENT_ACCEPTED {
if { [info exists ::active_clients([IP::client_addr])] } {
if {$::active_clients([IP::client_addr]) > 200 } {
reject
log local0. "Rejecting [IP::client_addr], 200 Active connections"
return
}
}
}
Happy testing! (Rules loaded fine with the Editor on v9.1.2, not that that ensures a working solution!)