How to redirect all traffic on all ports to another server? And also return? I mean, just combine 2 servers on 1 ip. Make one front-end server, and the rest of the server something like a "back end". The application is not a web, it works on different ports.
1 answer
It is possible to proxy in nginx:
server { listen 3333; location / { #ip другой машины в той же приватной сети proxy_pass http://10.1.1.2:3333/; include /etc/nginx/proxy_params; } } Or using iptables redirects immediately .
- that is, any application running on port 3333 will work adequately on another server? let's say this is a mysql server. Does this work?) Iptables tried, did tcp packets come back in theory when specifying such rules? - neatek
- interesting ...) and the "private network" between the servers do not tell me how to implement? - neatek
- @neatek when you pick up the machines, then select one private network. - Suvitruf ♦
- @neatek is there an option to combine 2 servers on the Internet (in different countries) into one virtual (private) network? - neatek
|
ip tunl) and doiptables ... -j DNAT --to-destination внутренний-ip-на-том-конце-туннеля. On the second server, the return traffic will have to be returned to the first. to do this, create a default route in another routing table (for example, table number 2)ip route add default tab 2 via внутренний-ip-на-туннеле-машины1and wrap the necessary trafficip rule add from ip-на-туннеле lookup 2- in Mike