Forum Discussion
Node selection for non-HTTP traffic
I've setup a standard VS with no HTTP profile applied, only TCP. The protocol I'd like to load balance is custom and TCP-based.
There's 1 iRule applied which I've based on this: https://devcentral.f5.com/codeshare/proxy-protocol-receiver
The application sends the correct PROXY header information which is confirmed in the logging.
I want to be able to route the TCP connection / data based on the client's source IP. I've tried adding the following 2 commands (not at the same time of course) under the "TCP::release" command to direct at a specific pool member:
pool Test_Pool member $dstaddr 2626
node "$dstaddr:2626"
I've added additional logging when certain events are triggered. The number after the event name is randomly generating when a client connects to track each connection. A session ID basically.
The issue is the node/port in the LB_SELECTED event, which is the correct one, doesn't match the SERVER_CONNECTED event and the connection fails.
: 57527607 CLIENT_ACCEPTED: 192.168.2.96:59381
: 57527607 TCPVER: TCP4 - SRCIP: 192.168.3.16 - DSTIP: 192.168.2.104 - SRCPORT: 64566 - DSTPORT: 2727
: 57527607 LB_SELECTED: 192.168.2.104:2626
: 57527607 SERVER_CONNECTED: 192.168.2.137:2626
The server should connect back to itself but on a different port. This is because I'll be doing further manipulation of the TCP data in the future but just trying to get the basic load balancing working for now.
Any ideas what might be going on here?
Cheers.
2 Replies
- VernonWells
Employee
Ordinarily, the server-side connection is initiated at the completion of the client-side three-way handshake, so the order of events should be:
- CLIENT_ACCEPTED
- LB_SELECTED
- SERVER_CONNECTED
- CLIENT_DATA
Since you execute the
command in CLIENT_DATA, this may raise LB_SELECTED again, but it would have no effect, since the server-side is already connected. Try performing an LB::detach before thenode
command.node
- DP
Nimbostratus
Hi Vernon.
I tried your suggestion of adding a
after theLB::deatch
and before theTCP::release
ornode
command but the same issue occurred.pool
I added more logging to track down what events fire and when.
The server is chosen, that is LB_SELECTED fires, after
is executed.TCP::release
and thenLB::detach
ornode
didn't seem to have any effect on the LB server decision.pool
I then removed the
and bothLB::detach
ornode
commands and addedpool
to the LB_SELECTED event and everything now works correctly.LB::reselect node $dstaddr 2626
So my summary sequence of events / commands is:
- No server chosen
- No server chosen
TCP::release
- A server from pool chosen
LB::reselect node $dstaddr 2626
- Correct server is chosen. 192.168.2.104 in example above.
TCP data flow
Another thing I tried was
in the CLIENT_ACCEPTED event.TCP::collect 5 0
That caused the SERVER_CONNECTED event to fire in the CLIENT_ACCEPTED event and the
and thenLB::detach
ornode
worked as expected.pool
However the client application expects a server banner to proceed and the SERVER_CONNECTED event doesn't fire for the new, correct server IP until data is received from the client. Therefore the connection stalls because the client never sends any more data while waiting for the server banner.
Thanks.
Recent Discussions
Related Content
* 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