Multi-Master VRRP set-up
Ekim
Posted on June 18, 2021
Weekly sharing
Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer.
Introduction
In the last week sharing, I revealed that I had failed to make my VRRP working. Fortunately, that was fixed and is running successfully now. One thing I noticed was that most resources online only taught people how to make master-backup VRRP instead of master-master. Today, I would like to share my configurations of Keepalived
for master-master usage.
Previously
Installation and configurations of keepalived
Machine one
sudo apt-get install keepalived
cd /etc/keepalived
vim keepalived.conf
# ----- vim keepalived.conf -----
vrrp_instance machineOne {
state MASTER
nopreempt # preempt = get back the master position when recovers, nopreempt = stay in backup position when recovers (dual-master setting)
interface eno1 # interface
virtual_router_id 101
priority 101 # same priority to make sure both machines are master
advert_int 1 # interval between advertisements
authentication {
auth_type PASS
auth_pass abcdefg
}
virtual_ipaddress { # virtual IP
192.168.29.11
}
}
# ----- vim keepalived.conf -----
Machine two
sudo apt-get install keepalived
cd /etc/keepalived
vim keepalived.conf
# ----- vim keepalived.conf -----
vrrp_instance esl35 {
state MASTER
nopreempt
interface eno1
virtual_router_id 101
priority 101
advert_int 1
authentication {
auth_type PASS
auth_pass abcdefg
}
virtual_ipaddress {
192.168.29.11
}
}
# ----- vim keepalived.conf -----
SSH key integration
Before starting the keepalived
service, we need to make sure that the SSH key files are the two machines are the same if master-master VRRP approach is adopted. This will avoid conflicts between machines.
# In any one of the machine
# e.g. 192.168.29.10
cd /etc/ssh
ls
# ----- ls -----
#moduli sshd_config ssh_host_dsa_key.pub ssh_host_ed25519_key ssh_host_rsa_key.pub
#ssh_config sshd_config.d ssh_host_ecdsa_key ssh_host_ed25519_key.pub ssh_import_id
#ssh_config.d ssh_host_dsa_key ssh_host_ecdsa_key.pub ssh_host_rsa_key
# ----- ls -----
# syncing all those files to another machine
# account@server-ip should be like abcd@192.168.29.10
rsync ./* < account@server-ip >:/etc/ssh
Conclusion
I hope you enjoy my sharing so far. I am not sure if I could keep writing and sharing every week. I aimed to make the VRRP working through rVRRPd
, but I could not find sufficient resources that could help me set that up successfully. If you do know how to make it working, please comment below no matter how ancient this sharing has become.
Posted on June 18, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.