Nginx TCP/UDP Load Balancer

Francis Daly francis at daoine.org
Wed Sep 2 07:56:52 UTC 2020


On Wed, Sep 02, 2020 at 01:08:43AM -0400, Dr_tux wrote:

Hi there,

> When I add the proxy_bind parameter, requests are never forwarded to the
> server behind.

Is there any hint in your nginx logs of what is happening?

For example, on one old system here, when I test the config as root,
I can see:

# sbin/nginx -t
nginx: [emerg] transparent proxying is not supported on this platform, ignored in /usr/local/nginx/conf/nginx.conf:240
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

and when I try to connect to my nginx udp port from a remote machine,
I see no hint of the request being forwarded; but I do see a [crit]
message in the nginx error log, of the form "bind(client ip) failed
(99: Cannot assign requested address) while connecting to upstream"

When I try to connect from the local machine, I do see the request being
forwarded, with the same source address as my original packet used -- the
192.168.x one, or the 127.0.x one. So proxy_bind is being attempted, and
my operating system setup is preventing the "external" address being used.

>     server {
>     listen        3478 udp;
>     proxy_pass    stream_backend;
>     proxy_bind $remote_addr transparent;
>     }

That looks correct; but the IP address that nginx is allowed to set as the
source IP for the packets that it sends, is not only controlled by nginx.

If you have similar logs, you may have a similar problem that may be
fixable by re-configuring the supporting system.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list