Keepalived for Ubuntu 16

Hello Everyone,

I was wondering if anyone might be able to help me out with setting up Keepalived on Ubuntu 16. I went ahead and followed the tutorial here on Digital Ocean but when I run sudo start keepalived I get an error saying that start isnt a recognized command.

I am having a hard time finding other resources but I suspect that I either need to use different command to start keepalived, or I need to modify the tutorial in some way.

Any help or advice would greatly be appreciated!

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

So I finally got things working. I wanted to write down what it was I needed to do to get things to running so hopefully anyone with a similar issue doesn’t have to sink in as much time as I did.

  1. I thought all you needed to do to enable private networking on my droplets was just click on the button in the control panel. Turns out there is a bit more work involved, you can see what you need to do here:

  2. Make sure you are downloading the latest version of keepalived. The version currently listed in the tutorial has a bug in it that prevents it from running the script. As of me writing this the newest version is 1.2.23. Just check here to see what latest version is:

  1. The python script that the tutorial uses to change the floating IP requires the requests module, which does not come standard with python that is bundled with Ubuntu 16. If you haven’t already, install python pip, and then use pip to install the requests module. I also ran into an error trying to install requests involving my locale. Here are the commands I used to get the python script to work

apt-get install python-pip export LC_ALL=C pip install requests

  1. With changes that came along with Ubuntu 16, upstart doesn’t apply anymore. I needed to create a new service on each of my droplets so that I could run them with systemctl. Doing the following set up things correctly on my droplets

sudo nano /etc/systemd/system/keepalived.service

Then I copied the following into the file, saved and closed it on both droplets

# keepalived control files for systemd
# Incorporates fixes from RedHat bug #769726.

Description=LVS and VRRP High Availability monitor

# Ubuntu/Debian convention:
ExecStart=/usr/local/sbin/keepalived --dont-fork
ExecReload=/bin/kill -s HUP $MAINPID
# keepalived needs to be in charge of killing its own children.


I then used the following commands to set up the keepalived service systemctl preset keepalived.service systemctl start keepalived.service

after that I was all good to go.

Keepalived outputs to syslog. I found it very useful to check those logs to help me debug a few of these issues that I had. You can view those logs via the following command: sudo cat /var/log/syslog

this will also include other processes as well so just keep an eye out for Keepalived or Keepalived_vrrp

Well I hope this is useful to anyone else out there in the future!

I am trying to run this on Ubuntu Bionic and keep seeing this :

killall5[somenumber]: only one argument, a signal number, allowed

Because of this, vrrp is not actually working and lb1 holds onto the Floating IP even if nginx is not running locally.

Here is my /etc/systemd/system/ file : [Unit] Description=Keepalive Daemon (LVS and VRRP)

Only start if there is a configuration file


[Service] Type=forking KillMode=process

Read configuration variable file if it is present

EnvironmentFile=-/etc/default/keepalived ExecStart=/usr/sbin/keepalived $DAEMON_ARGS ExecReload=/bin/kill -HUP $MAINPID


As far as I understand it, this file is what determines what keepalived “does” under SystemD. Killmode=process is the same as under Ubuntu 16 and 14.

Has anyone else had this issue ?

YES @ArtirigoOcean! Brilliant!