nginx udp代理聆听相同的端口并决定原始ip
我目前正在尝试根据原点进行NGINX代理工作,并将其传递给不同的IP。
stream {
server {
listen 1000 udp;
proxy_pass 10.0.0.2;
allow 10.0.0.3;
}
server {
listen 1000 udp;
proxy_pass 10.0.0.3;
allow 10.0.0.2;
}
}
显然,这是不起作用的,因为我无法在同一端口上两次听。我尝试了一些“如果”,但不允许那里。有什么想法吗?我只想代理两个IP之间的流量。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要透明的代理或某种数据包过滤器或防火墙,而不是
nginx
,因为它是反向代理,不适合您的任务。You need transparent proxy or some kind of packet filter or firewall, not
nginx
, since it is reverse proxy and not suitable for your task.虽然我不确定您选择了解决任务的正确方法(除非您需要某种负载平衡),但是使用多个
上游
blocks和 block:“ http://nginx.org/en/docs/stream/ngx_stream_geo_module.html” rel =“ nofollow noreferrer”>
geo
While I'm not sure you choose the right way to solve your task (unless you need some kind of load-balancing), however this this should be possible using several
upstream
blocks and thegeo
block:If you need a load-balancing, see the TCP and UDP Load Balancing article.