LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-23-2017, 04:15 AM   #1
myjess
LQ Newbie
 
Registered: Apr 2010
Posts: 11

Rep: Reputation: 0
tcp keepalive - why new connections have value slightly greater than value I just set.


Hi,
I have executed this command
sysctl -w net.ipv4.tcp_keepalive_time=2925
which reduces the keepalive time from the default 7200 seconds down to 2925 seconds.

But, for some reason, some new connections seem to start at a value of 2930 or thereabouts when I execute the command
netstat -an --timers | grep ESTAB

Can anyone explain this?

Thank you.
 
Old 02-24-2017, 05:37 AM   #2
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
I think, with netstat, you're measuring the remaining interval
Try running this shell script, add to the grep to limit the output to one of the sockets that exhibits this behaviour
Quote:
#!/bin/sh
erp=1
netstat -ano | head -2 | tail -1 | awk '{ print " --- " $8 " ------- " $9}'
while [ $erp -le 10 ]
do
netstat -ano | grep keepalive | awk '{print $6 " " $7 " " $8}'
sleep 1
erp=$(( $erp+1 ))
done
It gives me this output.
Quote:
--- State ------- Timer
ESTABLISHED keepalive (31.76/0/0)
ESTABLISHED keepalive (30.75/0/0)
ESTABLISHED keepalive (29.74/0/0)
ESTABLISHED keepalive (28.72/0/0)
ESTABLISHED keepalive (27.71/0/0)
ESTABLISHED keepalive (26.69/0/0)
ESTABLISHED keepalive (25.68/0/0)
ESTABLISHED keepalive (24.67/0/0)
ESTABLISHED keepalive (23.66/0/0)
ESTABLISHED keepalive (22.65/0/0)
If you see the same thing, look at the application that's associated with the socket, since keep_alive can be manipulated by the application layer or the peer you're connected to

Last edited by dijetlo; 02-24-2017 at 06:14 AM. Reason: Brevity and completeness
 
Old 02-24-2017, 06:16 AM   #3
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
And BTW, good question for your second post.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Max num of concurrent tcp connections && tcp auto tune rosv Linux - Networking 3 02-04-2011 02:57 AM
Multiple TCP connections ranban282 Linux - Networking 2 08-13-2009 04:04 PM
Kill TCP connections ballistic509 Debian 2 03-14-2007 05:33 PM
TCP/IP keepalive problem lsme AIX 1 08-02-2006 11:05 PM
how many TCP connections at a time? hegdeshashi Linux - Networking 5 01-05-2006 11:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration