r/linuxadmin • u/psfletcher • Mar 04 '26
Keepalived - as a load balancer
Hi all, I've got keepalived working nicely with the vip. But I'm struggling with the load balancer setup.
I've followed many different online sources and still running short.
The health monitors I can see coming in from both keepalived nodes. We're I "think " the issue maybe is the config on ubuntu itself.
So IPtables, or loopback addresses to the kernel knows how to deal with the packets. Or something like that.
Any ideas on where to start?
3
Upvotes
7
u/soldier_18 Mar 04 '26
why not using haproxy? its free, it uses vrrp-keepalived, pretty easy to configure and a lot of stuff you can do without touching the linux host much
1
u/BarServer Mar 04 '26 edited Mar 04 '26
Can help, but please post the keepalived.conf and, if possible, the network configuration from all interfaces. Else it is too much guesswork.
Edit: Read the link you posted. And I find the nonlocal IP stuff via sysctl to be superfluous. Just bind the VIP on loopback or create a non-arping dummy interface and put the IP there.
2
u/chock-a-block Mar 04 '26 edited Aug 30 '26
Amber aspiring rainstorm compass nutty meeting peach deer growth test
This post was anonymized with Redact
1
u/pur3s0u1 Mar 05 '26
with haproxy is the traffic loadbalanced like roundrobin on all "routers" with vip, or is balanced on hosts after?
1
u/Vagabond1980 Mar 06 '26
I think the missing component is the real servers not knowing they are supposed to grab the traffic. Keepalived uses ipvs under the hood and that acts as a router. The packets are forwarded unmodified to the backend server which means they have the 'wrong' destination address. Personally I use iptables REDIRECT rules to grab packets with the vip:port combo and process them on the backend server. The redirect rules are applied to the firewall on the backend, not the servers running keepalived
0
u/Gloinfur Mar 04 '26
You have two nodes with keepalived, which share a vip? But requests coming from both servers to your application server(s)?