Keepalived load balancing not working on 2 nodes setup

123 Views Asked by At

I am trying to set up keepalived load balancing on a system setup composed of 2 fedora 38 VMs.

I've already setup a VIP on these 2 machines, which works as expected, but now I was trying to set up load balancing, but this part doen't want to work.

My keepalived.conf for node 1 is :

vrrp_instance VI_1 {
  state MASTER
  interface ens18
  virtual_router_id 55
  priority 150
  advert_int 1
  unicast_src_ip 192.168.1.199
  unicast_peer {
    192.168.1.84
  }

  authentication {
    auth_type PASS
    auth_pass ***
  }

  virtual_ipaddress {
    192.168.1.100/24
  }
}
virtual_server 192.168.1.100 80 {
  delay_loop 6
  lb_algo rr
  lb_kind NAT
  protocol TCP

  real_server 192.168.1.199 80 {
    TCP_CHECK {
      connect_timeout 10
    }
  }
  real_server 192.168.1.84 80 {
    TCP_CHECK {
      connect_timeout 10
    }
  }
}

My keepalived.conf for node 2 is :

vrrp_instance VI_1 {
  state BACKUP
  interface ens18
  virtual_router_id 55
  priority 100
  advert_int 1
  unicast_src_ip 192.168.1.84
  unicast_peer {
    192.168.1.199
  }

  authentication {
    auth_type PASS
    auth_pass ***
  }

  virtual_ipaddress {
    192.168.1.100/24
  }
}
virtual_server 192.168.1.100 80 {
  delay_loop 6
  lb_algo rr
  lb_kind NAT
  protocol TCP

  real_server 192.168.1.199 80 {
    TCP_CHECK {
      connect_timeout 10
    }
  }
  real_server 192.168.1.84 80 {
    TCP_CHECK {
      connect_timeout 10
    }
  }
}

Any idea how I can make load balancing working with keepalived?

Thanks

1

There are 1 best solutions below

0
On

Based on your profile I'm guessing you're using one network interface, try:

lb_kind DR

You can paste more logs or use tcpdump and ipvsadm