From Wikipedia, the free encyclopedia
  (Redirected from Keep-alive)
Jump to navigation Jump to search

A keepalive (KA) is a message sent by one device to another to check that the link between the two is operating, or to prevent the link from being broken.


A keepalive signal is often sent at predefined intervals, and plays an important role on the Internet. After a signal is sent, if no reply is received the link is assumed to be down and future data will be routed via another path until the link is up again. A keepalive signal can also be used to indicate to Internet infrastructure that the connection should be preserved. Without a keepalive signal, intermediate NAT-enabled routers can drop the connection after timeout.

Since the only purpose is to find links that don't work or to indicate connections that should be preserved, keepalive messages tend to be short and not take much bandwidth. However, their precise format and usage terms depend on the communication protocol.

TCP keepalive[edit]

Transmission Control Protocol (TCP) keepalives are an optional feature, and if included must default to off.[1] The keepalive packet contains no data. In an Ethernet network, this results in frames of minimum size (64 bytes[2]). There are three parameters[3] related to keepalive:

  • Keepalive time is the duration between two keepalive transmissions in idle condition. TCP keepalive period is required to be configurable and by default is set to no less than 2 hours.
  • Keepalive interval is the duration between two successive keepalive retransmissions, if acknowledgement to the previous keepalive transmission is not received.
  • Keepalive retry is the number of retransmissions to be carried out before declaring that remote end is not available.

Keepalive on higher layers[edit]

Since TCP keepalive is optional, various protocols (e.g. SMB[4] and TLS[5]) add a similar feature on top of it. This is also common for protocols which maintain a session over a connectionless protocol, e.g. OpenVPN over UDP.[6]

Other uses[edit]

HTTP keepalive[edit]

The Hypertext Transfer Protocol uses the keyword "Keep-Alive" in the "Connection" header to signal that the connection should be kept open for further messages (this is the default in HTTP 1.1, but in HTTP 1.0 the default was to use a new connection for each request/reply pair).[7] Despite the similar name, this function is entirely unrelated.

Other devices[edit]

"Keep-alive" devices are used in automotive repair to maintain battery voltage for devices in the vehicle when the battery is disconnected or changed, usually by plugging in a small battery to the vehicle's 12 volt power outlet. A typical application is preventing the vehicle's radio or other device from going to "code" mode (security lockout) during vehicle repair. Typically a lower voltage source, such as a 9–volt battery, is sufficient for the purpose.

Electric clocks often have battery-powered keep-alive circuits to maintain time and other settings during a power outage. Some electronic devices use a capacitor circuit to maintain volatile memory when the user changes the battery.

See also[edit]


  1. ^ "Requirements for Internet Hosts - Communication Layers". IETF. October 1989. Retrieved November 8, 2013.
  2. ^ "3.1.1 Packet format" (PDF). IEEE Standard for Ethernet, 802.3-2015 – section one. 2016. p. 108. Retrieved 2018-10-02.
  3. ^ "Using TCP keepalive under Linux". Retrieved 2016-07-29.
  4. ^ "Protocol Standard for a NetBIOS Service on a TCP/UDP Transport: Concepts and Methods". IETF. March 1987. Retrieved June 18, 2015.
  5. ^ "Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS) Heartbeat Extension". IETF. February 2012. Retrieved June 18, 2015.
  6. ^ "OpenVPN manual page". Retrieved June 18, 2015.
  7. ^ "HTTP Keep Alive discourse by Jim Driscoll". Archived from the original on 2010-08-13.