我正在使用AWS实例,我有两个ENI eth0(192.168.1.100)和eth1(192.168.1.200),使用ETH0网络接口来接受客户端到NGINX(TCP)的传入连接以及一个ETH1网络从NGINX到目标的传出连接的接口(另一个实例TCP连接)。可以这样做吗?
答案 0 :(得分:1)
答案 1 :(得分:0)
@Alexander,谢谢。可以在下面的配置下正常工作
upstream my_tcp_connect {
server 192.168.1.300:9000;
zone tcp_mem 512k;
}
server {
tcp_nodelay on;
listen 9000 backlog=409600 so_keepalive=30m::10 reuseport;
proxy_pass my_tcp_connect;
proxy_connect_timeout 5s;
proxy_buffer_size 512k;
error_log /var/log/nginx/tcp_error.log info; # nginScript debug logging
proxy_bind 192.168.200;
}
我发现从NGINX实例建立了一些连接,
tcp 0 0 192.168.200:59396 192.168.300:9000 ESTABLISHED 3046/nginx: worker
tcp 0 0 192.168.200:58680 192.168.300:9000 ESTABLISHED 3049/nginx: worker
tcp 0 0 192.168.100:9000 192.30.40.14:53110 ESTABLISHED 3048/nginx: worker
tcp 0 0 192.168.100:9000 192.30.40.14:54924 ESTABLISHED 3049/nginx: worker
TCP连接实例:
tcp 0 0 192.168.1.300:9000 192.168.200:58632 ESTABLISHED 1997/tcp_connect
tcp 0 0 192.168.1.300:9000 192.168.200:59160 ESTABLISHED 1997/tcp_connect
tcp 0 0 192.168.1.300:9000 192.168.200:59360 ESTABLISHED 1997/tcp_connect
tcp 0 0 192.168.1.300:9000 192.168.200:59298 ESTABLISHED 1997/tcp_connect