Forum Discussion
Ganesh_Ramamoor
Nimbostratus
Jun 09, 2006TCP iRule help
Thanks to you guys' help, I have this iRule:
when CLIENT_ACCEPTED {
TCP::collect
}
when CLIENT_DATA {
if { [TCP::payload] contains "xxx" } {
LB::detach
pool xxx
persist uie "[IP::client_addr]:[TCP::client_port]"
}
elseif { [TCP::payload] contains "yyy" } {
LB::detach
pool yyy
persist uie "[IP::client_addr]:[TCP::client_port]"
}
elseif { [TCP::payload] contains "zzz" } {
LB::detach
pool zzz
persist uie "[IP::client_addr]:[TCP::client_port]"
}
TCP::release
TCP::collect
}
This pretty much does what I'm looking for, the load balancing to the different types of pools and the persistence. But every time the client comes in with "yyy" the previous TCP connection is cleared and a new connection is established because of the LB::detach. And I need that LB::detach 'cause without that when the packets switch from "xxx" to "yyy" they would still be sent to pool xxx. Is there a way to keep the TCP connection up across the subsequent "yyy" packets?
Thanks in advance.
1 Reply
- Ganesh_Ramamoor
Nimbostratus
Yes that worked, with one slight change of picking the pool only after a detach, as shown below. Thanks for your help.
The LB::server and the LB::detach are per tcp connection, it appears, which is good, 'cause I was a little concerned about that. I tried this with 2/3 simultaneous clients and it seem to work fine.
when CLIENT_ACCEPTED {
TCP::collect
}
when CLIENT_DATA {
set poolname "[LB::server pool]"
if { [TCP::payload] contains "xxx" } {
if { $poolname ne "xxx" } {
LB::detach
pool xxx
}
}
elseif { [TCP::payload] contains "yyy" } {
if { $poolname ne "yyy" } {
LB::detach
pool yyy
}
}
TCP::release
TCP::collect
}
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
