Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to find a tool that allows me to do the following:
I have machine A behind a NAT\Router with a web application, then I have server B accessible on the internet.
Using some application all TCP requesting incoming to server B on port N would be redirected to machine A on port 80. This way the web application would be exposed on the internet.
I would like to achieve this without changing any configuration on the router of machine A's network.
There would be some client tool running on machine A that would keep the connection open with server B and allow for this redirection.
In the future other machines like A, but on other local networks would have a similar mechanism where they would be reachable from the server B by usşing other ports.
Can anyone tell me what kind of tool I'm looking for? I keep reading about HTTP Tunnel and VPN, but I'm not sure that's exactly what I need.

Edit: Some missing information, A and B are running Windows, the NAT is usually done by a normal ADSL router, A and B are not on the same subnet nor behind the same NAT, A is behind the NAT, B is connected directly to internet.

share|improve this question
add comment

4 Answers

Sounds to me like your asking to set-up a reverse proxy?

So this would be a server that listens on a port on machine B, which you could set-up/configure to pass requests coming in on that port to server B as long as B can talk to A.

So hxproxy possibly or nginx apache mod_proxy that type of thing. Have a quick read on Reverse proxies and see if that's the kitty for you

share|improve this answer
add comment

Some more information would help: Which operating systems are A, B and the NAT/Router running? Is B also behind the same NAT/Router as A? Are A and B on the same subnet?

share|improve this answer
add comment

One of the many solution is to use a ssh tunnel on A :

ssh -R <B IP>:<B port>:<A ip>:<A port>

With this option ssh will open the specified port/IP on B and redirect every connection made on this port on the specified port/IP on A.

You should enable the GatewayPorts option in sshd config on server B (otherwise you could only open a port on 127.0.0.1) and you have to be root as usual if you want to open a privileged port (below 1024).

share|improve this answer
add comment

I was able to do what I wanted with a TeamViewer VPN and a TCP Tunnel tool.
I opened a VPN connection to the machine I need with TeamViewer, and I redirect tcp connection on port X to the VPN ip on the port 80.
In the future we are planning to build a client/server tool that can do this tcp tunneling. I thought it would be easier to find a tool already doing this. But this requires a way to keep a connection open with the machine behind the NAT without any reconfiguration on the NAT, which is what Teamviewer does.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.