tcp_keepalive_probes - the number of probes that are sent before the client considers the connection broken and notifies the application layer
tcp_keepalive_time - the interval between the last data packet sent and the first keepalive probe
tcp_keepalive_intvl - the interval between subsequent keepalive probes
tcp_retries2 - max number of times a packet is retransmitted before giving up
Operating directory where these parameters are stored /proc/sys/net/ipv4/
/proc/sys/net/ipv4/tcp_keepalive_time
Values are expressed in seconds. Example tcp_keepalive_time of 7200 would mean 2 hours
In order to retain your value after system restart, these need to be added to /etc/sysctl.conf
The total time before Operating system will give up on a connection is
tcp_keepalive_time + tcp_keepalive_intvl*tcp_keepalive_probes
Reference to tcp keepalive