Skip to main content

Keep Alive

At Keep Alive (also called KA), it is a message sent from one device to another to verify that the connection between the two is working or to prevent the connection from being broken.

Description of Keep Alive

A signal from Keep Alive is sent very frequently at predefined intervals and plays a significant role on the Internet. If no response is received after the signal is sent, the program assumes that it is a connection interruption. Thus, all further data is sent via a different path. This continues until a connection can be re-established.

Since the only purpose is to find broken links or to indicate connections that should be maintained, Keep Alive messages are usually short and do not consume much bandwidth. However, their exact format and terms of use depend on the communication protocol.

TCP-Keep Alives

TCP-Keep Alives(Transmission Control Protocol) are an optional feature and, if included, must be disabled by default. The KA packet does not contain any data. In an Ethernet network, this results in frames with a minimum size (64 Byte). There are three parameters that refer to KAs:

  • The KA time is the duration between two idle KA transmissions. The TCP retention time shall be configurable and shall be set to at least two hours by default.
  • The KA interval is the duration between two consecutive KA retransmissions when no acknowledgement is received for the previous KA transmission.
  • The KA retry is the number of retransmissions that must be performed before declaring that the remote end is not available.
TCP-KA packets can also be used to check whether the desired connection is still valid. However, here two hosts must be connected via TCP/IP (one network). Most hosts that support TCP also support TCP-Keep Alives. Each host (or peer) periodically sends a TCP packet to its peer requesting a response. When a certain number of Keep Alives are sent and no response (ACK) is received, the sending host terminates the connection from its end. When a connection is terminated due to a TCP-KA timeout and the other host eventually sends a packet for the old connection, the host that terminated the connection sends a packet with the RST flag set to indicate to the other host that the old connection is no longer active. This forces the other host to terminate the end of the connection so that a new connection can be established.

Typically, TCP Keep Alives are sent every 45 or 60 seconds on an inactive TCP connection. The connection is terminated after three consecutive ACKs are missed. This varies depending on the host. For example, by default, Windows PCs send the first TCP Keep Alive packet after 7,200,000 ms (2 hours) and then 5 Keep Alives at 1,000 ms intervals. The connection is terminated if there is no response to any of the KA packets.

Keep Alive s on higher layers

Since TCP-KA is optional, several protocols (e.g., SMB and TLS) implement their own KA function in addition to TCP. It is also common for protocols that manage a session over a connectionless protocol, e.g. OpenVPN over UDP, to implement their own KA function.

Do you have any more questions?

Please contact us

Further contents