cancel
Showing results for 
Search instead for 
Did you mean: 

TCP keep-alive packets

VileReynard
Seasoned Pro
Posts: 10,825
Thanks: 250
Fixes: 10
Registered: 01-09-2007

TCP keep-alive packets

I've noticed that my connection is sending (and receiving) rather a lot of TCP keep-alive packets.
My connection stalls briefly whilst this happens.
Should I change any of the TCP timers to fix this?

2 REPLIES
MJN
Aspiring Pro
Posts: 1,099
Thanks: 51
Fixes: 2
Registered: 26-08-2010

Re: TCP keep-alive packets

You might need to provide a bit more information.
Keepalives shouldn't cause any connection issues as they are such tiny packets.
Post the current value of your timers:
cat /proc/sys/net/ipv4/tcp_keep*
75
9
7200

These value are the interval (seconds between keepalives), probes (number of keepalives before closing the connection) and time (seconds before any keepalives are sent) respectively.
They are useful to have in order to close down any stale TCP connections. Increasing the timers would only end up delaying the issue, and reducing the number of probes could only fix the symptom rather than the cause. Of course, perhaps your figures are way off the above (which are fairly typical) in which case something might be amiss.
All that said, they shouldn't be causing you an issue as mentioned. Can you elaborate on what you mean when you say that your 'connection stalls briefly'?
VileReynard
Seasoned Pro
Posts: 10,825
Thanks: 250
Fixes: 10
Registered: 01-09-2007

Re: TCP keep-alive packets

Mine are the same as yours (I think they are the defaults).
At random my only wired connection sends a bunch of 6 - 10 keepalives (and receives) a similar number of ACK's in response.
Actually, I've taken a wireshark capture - with DNS lookup.
It's very instructive.
Many web sites seem to be sending back tracking information - I suspect some are issuing keepalives to send back which bit of a web page my cursor is sitting on? ? ?
In the screenshots below "hector" is my local PC.
So I'll put these down to clunky web sites - and try loading some better ad-blocking software.