UDP Load balancing

Roman Arutyunyan arut at nginx.com
Tue Jan 28 14:02:27 UTC 2020


Hi,

On Tue, Jan 28, 2020 at 08:52:53AM -0500, arigatox wrote:
> 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:

Your nginx is too old.  UDP session persistence has been introduced in mainline
version 1.15.0 and is available in stable version 1.16.0.

> 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
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

-- 
Roman Arutyunyan


More information about the nginx mailing list