I am trying to set up reverse proxy meant to serve multiple STUN clients and proxy the communication to multiple upstream servers. I have increased the file descriptors limit for the service so that shouldn't be an issue. My nginx.conf looks more or less like this:
user root;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
include /etc/nginx/sites-enabled/*.conf;
events {
worker_connections 1000000;
multi_accept on;
}
stream {
upstream stun_backend {
server 192.168.1.10:3478 max_fails=0;
server 192.168.1.11:3478 max_fails=0;
}
server {
proxy_timeout 30m;
listen 3478 udp reuseport;
proxy_pass stun_backend;
}
}
Everything works fine until I get around 28232 (my ephemeral port range is of this size) "udp ESTAB" connections to upstream servers. This is when I start getting the "Resource temporarily unavailable" errors and clients lose ability to contact the stun servers.
I was under the impression that the "IP_BIND_ADDRESS_NO_PORT" option used by NGINX since version 1.11.2 would help with the problem by reusing existing source ports as long as the destination was different so that the 4-tuple is unique and realistically I should be able to serve 28232 * number_of_upstream_hosts
but that doesn't seem to be the case.
Am I mistaken about what this option is meant to do? Is what I'm trying to do even achieveable? If so, how?