Forum Discussion
Anjlica_110059
Nimbostratus
Aug 09, 2007iRule closes connection
I modified the original question after I realised CLIENT_CONNECTED is not the right state to use inthe iRule when no connections exist.
------------------------------------------------
Hi,
We just introduced this iRule to persist incoming packets based on source ip and port.
Our call flow:
Client 1 ---> opens TCP connection with F5 ---> Round Robbing between sever 1 and server 2.
Onec conenctions are set up, then we want F5 to start using an iRule -
when CLIENT_ACCEPTED {
set src_ip_and_port [[IP::client_addr] ":" [TCP::client_port] ]
if { $src_ip_and_port != "" } {
persist uie $src_ip_and_port
}
}
When the client initially sets up new connections, there is no connection already set up so the F5 closes the incoming connections. Is there a state that we can use so that F5 bypasses this iRule when brand new connections are being set up?
- hoolio
Cirrostratus
In general, it's a good idea to check the /var/log/ltm file for TCL errors and iRule logging. You can do this via the GUI in system >> logs >> local traffic or by accessing the command line and tailing the file (tail -f /var/log/ltm). - Anjlica_110059
Nimbostratus
Our application opens tcp connections to the servers in the pool when ti is started. Once the tcp connection is established, it does a "log in" to the servers using a userid/passwd - same userid/passwd to all servers. The client hen stays logged in and sends requests on those exising connections(same ip and src port). So we want the F5 to send the requests(PSH,ACK) to the same server where this source port was initially set up at. - Deb_Allen_18Historic F5 AccountThat will happen naturally, in following with standard TCP mechanics: Once the connection is established, LTM keeps track of which server was selected, and all packets belonging to that connection will be sent there.
- Anjlica_110059
Nimbostratus
I am geeting closer. Here is a draft: - Deb_Allen_18Historic F5 AccountStill won't work without the changes hoolio recommended.
- Anjlica_110059
Nimbostratus
Here is the set up we have -when CLIENT_ACCEPTED { TCP::collect 6 log local0. "HERE 1" } when CLIENT_DATA { set payload_string [TCP::payload] log local0. "data [TCP::payload]" if {$payload_string contains "LOGIN"} { pool mypool log local0. "new" } else { log local0. "HERE 2" set src_ip_and_port [TCP::client_port] log local0. "src port <$src_ip_and_port>" if { $src_ip_and_port != "" } { log local0. "persist" } else { log local0. "error1" } } TCP::release }
- Deb_Allen_18Historic F5 AccountWell, the problem is still that a source port cannot be re-used by the client to connect to the same server until a network-significant amount of time has passed, so your rule really won't do anything at all but create persistence records that will never be followed.
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