Linux – In linux does “/proc/sys/net/ipv4/tcp_keepalive_time” has impact on both client & server

linuxtcp

We have a machine running on linux where we are exposing & also consuming SOAP based web services that use Keep Alive settings. Now when we change the TCP keep alive time out value by setting "/proc/sys/net/ipv4/tcp_keepalive_time" in linux, will this affect both TCP clients and servers running in this linux box?

Additional Information : We use apache camel-cxf endpoints deployed in apache karaf(servicemix) to expose and consumer SOAP based webservices.

Best Answer

Linux kernel's built-in support for TCP keepalive affects all keepalive-enabled TCP sockets.

TCP keepalive is not enabled by default, though: the applications must explicitly request keepalive control for their sockets using the setsockopt interface.

You can check whether keepalive is enabled on a specific socket by using the netstat command with the -o, --timers option:

Here you can see that the same process can open different network sockets in both modes:

# netstat -anpo | grep 8999
tcp        0      0 10.10.171.44:48744         10.10.139.30:8999          ESTABLISHED 18232/java          keepalive (83.39/0/0)

# netstat -anpo | grep 8009
tcp        0      0 10.10.171.44:8009          10.10.171.42:40947         ESTABLISHED 18232/java          off (0.00/0/0)