Keepalived is a routing software written in C. It brings simple and robust load
balancing and high availability to Linux systems and Linux based
infrastructures, and it runs in production across data centers, ISPs and
hardware vendors worldwide.
What is Keepalived?
Keepalived builds load balancing on top of the well known
Linux Virtual Server (IPVS) kernel
module, which delivers Layer 4 load balancing. On top of IPVS, Keepalived runs a
set of health checkers that watch each server pool and decide, in real time,
whether a real server stays in the topology or drops out according to its
health.
High availability comes from the VRRP
protocol, the fundamental brick for router failover. Keepalived adds a set of
hooks to the VRRP finite state machine so it can react with low level, high
speed protocol interactions. To detect network failures as fast as possible it
also implements BFD, and a VRRP state
transition can take a BFD hint into account to drive a fast failover.
Each framework works on its own or together with the others, so you can build
exactly the resilient infrastructure you need.
Three frameworks, one daemon
| :shield: High availability (VRRP) | :balance_scale: Load balancing (LVS/IPVS) | :heartpulse: Health checking & BFD |
|---|
| A full implementation of VRRP v2 and v3 for IPv4 and IPv6, with sync groups that keep routing paths consistent after a takeover, plus IPSEC-AH securing of protocol adverts. | Layer 4 load balancing driven by the kernel IPVS module, configured and maintained from a single place, with several scheduling algorithms and forwarding methods. | Layer 4 to Layer 7 checkers add and remove real servers automatically, while BFD detects link and peer failures in milliseconds to trigger fast VRRP transitions. |
Keepalived is articulated around a central I/O multiplexer that drives a strong
multi threaded framework, and every event runs through this multiplexer. For
robustness the daemon splits into a minimalistic parent process that monitors
its children, while dedicated child processes run the VRRP, health checking and
BFD stacks. The Software Design
page covers the internals in detail.
Quick start
Most Linux distributions ship Keepalived as a mainline package, which is the
quickest path to a working install:
sudo apt install keepalived # Debian / Ubuntu
sudo dnf install keepalived # RHEL / Fedora / Rocky
A minimal floating IP that fails over between two nodes needs a single file,
/etc/keepalived/keepalived.conf. On the master:
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass changeme
}
virtual_ipaddress {
192.168.1.100/24
}
}
On the backup use the same file, but set state BACKUP and a lower priority.
The node with the highest priority becomes master and carries the address.
[!NOTE]
The virtual_router_id must be identical on both nodes and unique among the
VRRP routers on the LAN. Change auth_pass to your own value, and remember it
travels in clear text, so VRRP authentication only guards against
misconfiguration, not against an attacker on the wire.
Start the service on both hosts:
sudo systemctl enable --now keepalived
The full Quick Start
goes further and adds a load balanced service behind the floating IP.
Building from source
git clone https://github.com/acassen/keepalived.git
cd keepalived
./configure
make && sudo make install
Building from the git tree needs autoconf, automake and a few libraries. The
INSTALL file lists what to install per distribution and what to run
before building.
Documentation
The full documentation lives at keepalived.org:
- User Guide for installation, configuration and the core concepts.
- keepalived.conf(5) for the exhaustive reference of every keyword.
- Release Notes and the ChangeLog for the project history.
Community
The Keepalived Users Group is the place
to ask questions, share configurations and follow announcements. Report bugs and
propose features on the issue tracker,
and include a minimal configuration that reproduces the problem. Release
announcements are posted on the Keepalived account on X.
[!IMPORTANT]
AI tools are welcome, yet the core team keeps the code base small, clear and
auditable. Large machine generated patches, comments or reports will not be
read. Keep your work lean whether or not an AI helped, and read the
Using AI tools guidance first.
License
Keepalived is free software, Copyright (C) 2000-2026 Alexandre Cassen. You can
redistribute it and modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 2 of the License,
or any later version. See the COPYING file for the full terms.
OpenSSL toolkit licence exception
In addition, as the copyright holder of Keepalived, I, Alexandre Cassen,
<[email protected]>, grant the following special exception:
I, Alexandre Cassen, <[email protected]>, explicitly allow the
compilation and distribution of the Keepalived software with the OpenSSL
Toolkit.