UDP Load balancing

arigatox nginx-forum at forum.nginx.org
Tue Jan 28 13:52:53 UTC 2020


Hi, I am testing nginx as a reverse proxy/load balancer for UDP. I have
configured the upstream servers, and it is working fine, except one issue
that is driving me crazy.

It seems that nginx does not keep the udp source ports between requests. It
changes the source port on every request. So I can't use it to load balance
udp protocols that needs several packets (for example, wireguard).

I am using  version 1.14.0 on Ubuntu and this is my config file:

stream {
  upstream udp_backend {
    hash $remote_addr;
    server 10.0.0.3:5180;
    server 10.0.0.4:5180;
  }
  server {
      listen 5180 udp;
      proxy_pass udp_backend;
      proxy_bind 10.0.0.2:5181;
  }
}

Is there any parameter that allows me to preserve udp ports?
Thanks.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,286837,286837#msg-286837



More information about the nginx mailing list