During the past few days I tried a few things to make my VPS proxy tcp traffic (depending on port) to my home server (both ubuntu servers).
Client <------> VPS <------> Home server
To be more specific, I've got a home server running some apps that I want to be hidden behind my VPS (not on the same subnet) and I want source ip to be preserved when a client tries to reach an app on my home server.
Currently I'm running NGinx streams as a reverse proxy. It works pretty well but client ip is lost (replaced by my VPS ip). There is on option to keep it proxy_bind $remote_addr transparent;
but it would require my home server to output traffic to my VPS like a gateway (and I do not have a solution for this without having both of them on the same network).
I tried using SSH Port Forwarding but source ip is also lost (replaced by my home server local ip). I also tried IP Gre tunneling (Didn't make it at the end...)...
The best for me would be that my VPS and my home server are connected through a tunnel, I think ?
Client <------> ( VPS <-tunneled-> Home server )
But as I said, all I need is to send VPS port specific traffic to my home server with source ip preserved and my VPS ip as server ip.
Hope someone will have a solution !
Have a great day !