IPVS (keepalived) doesn't balance UDP connections

Solution 1:

virtual_server 10.20.20.195 12333 {
    delay_loop 60
    protocol UDP
    lb_algo wrr
    lb_kind DR
    ops # <<< - Try this. Works for me (Ubuntu 18.04, Keepalived v1.3.9, ipvsadm v1.28) 

    real_server 10.20.20.196 12333 {

Option ops for me works only if either:

  • Virtual server port is explicitly defined.
  • fwmark is used together with in virtual_server definition.

Does not work for virtual_server_IP 0 form - in that case ipvsadm -Ln shows that persistent option is used as well.