Richard_Young_1
Mar 16, 2012Nimbostratus
Irule to limit number of out connections to a specific IP address
I need an IRule to block outgoing connection requests to a specific IP address after 1 connection is already established.
I looked at samples and was wondering if this irule would work?
Also I would want to add a specific port to the ip address so that the connections would be limited to 1 to say 172.20.155.144 port 2301
bigpipe rule '_blocktcp_connections {
when RULE_INIT {
set ::max_connections 1
set static ::active_connections 0
}
when CLIENT_ACCEPT {
this should allow all other connections to pass
if { not [IP::addr [IP::local_addr] equals 172.20.155.144] }
{
return
}
this should prevent additional connections to destination
if {$::active_connections > $::max_connections}
{
reject
}
set::active_connections 1
}
when CLIENT_CLOSED {
incr ::active_connections 0
}'