Forum Discussion
lstewart_53611
Nimbostratus
Apr 21, 2010Limiting number of connected clients
I am trying to write a rule to limit the number of individual clients that can connect to a VS, but not limit the total number of connections that they can have. After that limit has been reached, ad...
nitass
Employee
Nov 15, 2011i revised the table command's example a little bit. may it be usable?
[root@ve1023:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.65.152:ssh
ip protocol tcp
rules myrule
}
[root@ve1023:Active] config b rule myrule list
rule myrule {
when CLIENT_ACCEPTED {
event CLIENT_CLOSED disable
set tbl "clientlimit"
set key "[IP::client_addr]"
log local0. "[IP::client_addr]:[TCP::client_port]|[table keys -subtable $tbl]|[table keys -subtable $tbl -count]"
if {[table lookup -subtable $tbl $key] equals ""} {
if {[table keys -subtable $tbl -count] > 0} {
reject
log local0. "[IP::client_addr]:[TCP::client_port] is rejected"
} else {
table set -subtable $tbl $key "ignored" 180
set timer [after 60000 -periodic {table lookup -subtable $tbl $key}]
event CLIENT_CLOSED enable
}
}
}
when CLIENT_CLOSED {
after cancel $timer
table delete -subtable $tbl $key
}
}
[root@ve1023:Active] config tail -f /var/log/ltm
Nov 15 08:27:58 local/tmm info tmm[4766]: Rule myrule : 192.168.204.7:53985||0
Nov 15 08:28:05 local/tmm info tmm[4766]: Rule myrule : 192.168.204.7:53989|192.168.204.7|1
Nov 15 08:28:15 local/tmm info tmm[4766]: Rule myrule : 192.168.204.7:53991|192.168.204.7|1
Nov 15 08:28:24 local/tmm info tmm[4766]: Rule myrule : 172.28.17.30:56279|192.168.204.7|1
Nov 15 08:28:24 local/tmm info tmm[4766]: Rule myrule : 172.28.17.30:56279 is rejected
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
