Under construction, consider it a personal note for now.
graph LR;
A["`**HA1** (192.168.1.101) `"]
D["`**HA2** (192.168.1.102) `"]
B["`**MR1** (192.168.1.103) `"]
C["`**MR2** (192.168.1.104) `"]
E["`**Floating IP** (192.168.1.200) `"]
E-->A;
E-.->D;
A-->B;
A-->C;
D-.->B;
D-.->C;
In this setup, we use keepalived
to manage the floating IP failover:
Two HAProxy Instances:
HA1
(Active): Runs on one server (e.g., 192.168.1.101
).HA2
(Passive/Backup): Runs on a second server (e.g., 192.168.1.102
).Floating IP:
192.168.1.200
) is used as the virtual IP for clients to connect to HAProxy.192.168.1.101
).keepalived:
Two backend servers:
MR1
and MR2
(e.g., 192.168.1.103
and 192.168.1.103
) in this example, we are doing a mail-relay with postfix, but that is outside of the scope of this post.vim /etc/NetworkManager/system-connections/eth0.nmconnection
...
address1=192.168.1.101/24,192.168.1.1
address2=192.168.1.200/32
...
vim /etc/NetworkManager/system-connections/eth0.nmconnection
...
address1=192.168.1.102/24,192.168.1.1
...
Listening on floating IP on both servers.
vim /etc/haproxy/haproxy.cfg
...
bind 192.168.1.200:25
...
server MR1 192.168.1.103:25 check
server MR2 192.168.1.104:25 check
...
Master/Slave config
vim /etc/keepalived/keepalived.conf
check if running MASTER
auth
vim /etc/keepalived/keepalived.conf
check if running BACKUP
auth
setsebool -P haproxy_connect_any=1
getsebool -a | grep -i hap
haproxy_connect_any --> on
/etc/sysctl.conf ?
firewall-cmd --add-service=smtp --permanent
firewall-cmd --permanent --add-rich-rule='rule protocol value="vrrp" accept'
firewall-cmd --reload