Forum Discussion
TCP KeepAlive - Avoid long client connection without data
Hello,
I have virtual servers with type "Standard", TCP profile and HTTP profile. (BigIP LTM 1600, v 11.2.0)
The problem is that some users stay connected indefinitly using TCP keep alive.
For the TCP profile, the max idle time is set to 300sec, but the client reset the connection idle time sending a tcp keepalive...
- Is there a way to define a maximum duration for connection when no data is sent/received...?
- How can I show the creation date of all tcp connection ? (to identify long duration....)
Thanks!
21 Replies
- What_Lies_Bene1
Cirrostratus
Any idea why the client is sending the keepalives, it's not typical behavior. - fabianlumy
Nimbostratus
No idea why I have client that use TCP keepalive... It can be a system setting (linux allow to define this at system level), or firewall setting (like cisco "dead peer detection" which send TCP keepalive)...
Commonly, public website usually send a "TCP RST" between 1 minute to 30 minutes after the last HTTP response....
- What_Lies_Bene1
Cirrostratus
Have you used that script with a public website to prove that they are somehow doing something different? Can you list your VS and TCP profile settings here (suitably anonymised?) - fabianlumy
Nimbostratus
Yes I've used my script the other public website, and for all I've tested, send a RST after a timeout even if tcp keepalive are sent.
Here is the very simple configuration:ltm profile tcp /Common/tcptest { app-service none close-wait-timeout 5 defaults-from /Common/tcp fin-wait-timeout 5 idle-timeout 360 keep-alive-interval 4294967295 max-retrans 8 receive-window-size 65535 send-buffer-size 65535 syn-max-retrans 3 time-wait-timeout 2000 zero-window-timeout 20000 } ltm profile http /Common/http-conf1 { app-service none defaults-from /Common/http insert-xforwarded-for disabled max-requests 200 } ltm virtual /Common/VS { destination /Common/X.X.X.X:80 ip-protocol tcp mask 255.255.255.255 pool /Common/POOL1 profiles { /Common/http-conf1 { } /Common/oneconnect { } /Common/tcptest { } } snat automap translate-address enabled translate-port enabled vlans-disabled } ltm virtual-address /Common/X.X.X.X { address X.X.X.X mask 255.255.255.255 traffic-group none }
- What_Lies_Bene1
Cirrostratus
I can't test unfortunately but as you are using OneConnect (and perhaps even if not) surely all the client-side connections are not duplicated server-side? What TCP profile is used server-side? Does the keepalive keep the server-side connection open also? I doubt it. If you could test/check that would be great. If it doesn't we could use the SERVER_CLOSED iRule event to terminate the client-side connection but possibly we'll have to disable OneConnect to use if effectively. - Hamish
Cirrocumulus
@Erlo - fabianlumy
Nimbostratus
@Steeve:!/usr/bin/env python import socket import sys import time HOST = 'X.X.X.X' GET = '/toto' PORT = 80 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if 1: sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, 2) sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPINTVL, 5) sock.connect((HOST, PORT)) sock.send("GET %s HTTP/1.1\r\nHost: %s\r\nConnection: Keep-Alive\r\n\r\n" % (GET, HOST)) while 1: try: data = sock.recv(1024) if len(data): print data else: break except: break print "Socket end: Possibly TCP FIN received - TCP state should be TIME_WAIT" while 1: time.sleep(10)
- What_Lies_Bene1
Cirrostratus
The Idle Timeout in the FastHTTP profile is for TCP, not HTTP unfortunately. - What_Lies_Bene1
Cirrostratus
Check me out Hamish, standing up for standards! =] - Hamish
Cirrocumulus
I'm not convinced it's actually poorly configured clients...
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