Forum Discussion
WC_159542
Nimbostratus
Jun 03, 2014Session Counter iRule For IPv6
Dear All:
We use iRule below count session is work for ipv4 but not ipv6.
Anyone know why??
when HTTP_REQUEST {
set static::maxquery 100
set static::holdtime 6
set static::tracki...
Jun 03, 2014
Hi!
Adding some formatting to rule to make it easier for other people to help as well. 🙂
when HTTP_REQUEST {
set static::maxquery 100
set static::holdtime 6
set static::tracking_memlimit 0
set static::tracking_maxentry 40000
set static::blacklist_memlimit 1
set static::blacklist_maxentry 40000
log local0.info "Estimated memory usage for tracking: [expr (160*256/1024) * \ $static::tracking_maxentry / 1000] MBytes"
log local0.info "Estimated memory usage for blacklist: [expr (160*256/1024) * \ $static::blacklist_maxentry / 1000] MBytes"
}
when CLIENT_ACCEPTED {
set srcip [IP::remote_addr]
set sub [getfield $srcip "." 4]
if { [table lookup -subtable "blacklist:$sub" $srcip] != "" } {
drop
return
}
if { $static::tracking_memlimit == 1 } {
set total [table keys -subtable $sub -count]
if { $total > $static::tracking_maxentry } {
drop
return
}
}
set curtime [clock second]
set key "count:$srcip:$curtime"
set count [table incr -subtable $sub $key]
table lifetime -subtable $sub $key 2
if { $count > $static::maxquery } {
if { $static::blacklist_memlimit == 1 } {
set total [table keys -subtable "blacklist:$sub" -count]
if { $total > $static::blacklist_maxentry } {
drop
return
}
}
table add -subtable "blacklist:$sub" $srcip "blocked" indef $static::holdtime
table delete -subtable $sub $key
drop
return
}
}
I'll see if I can find something.
/Patrik
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects