Photo by Jordan Harrison on Unsplash

Increase application availbility with keepalived

How to change dynamicaly an IP-Adress from one server to another

Dominik Robert
6 min readApr 18, 2021

--

Introduction

When working with important applications its useful to have it on multiple machines, but that is not enough because on failure you will still lost your connection to that adress. It would be perfect to support a failover with an ip adress and change it at any failure to another server. This can be done with heartbeat, pacemaker and corosync, but these applications are very complex and extensive and for this simple scenario maybe too complex. For this, there is a much smaller application: keepalived

What is keepalived

keepalived is a software that is available in nearly every linux distribution or can be downloaded via the standard package manager like apt. With this software you can assign so called floating ips (ip adresses which are reserved to dynamically switch from server to server) to a group of servers and the keepalive process will manage all for you.

Preperations

As a prepreration I have installed two Ubuntu 18.04 servers with following names and adresses:

  • server1 => 192.168.1.2
  • server2 => 192.168.1.3

--

--