0

I have a server behind gateway, which means it’s only pingable internally. Now I want to forward traffic from a outside server to this internal server. I want to use socat like:

socat TCP4-LISTEN:8080, TCP:[internal server]:8080 # on external server

Which clearly won’t work because the IP address of that server is not available.

So how can I achieve this? I am open to any solutions.

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
qqibrow
  • 101
  • 2
  • 1
    I would look into using something like nginx as a reverse proxy. – heavyd Mar 14 '15 at 03:53
  • Nginx is fine, but Apache [can be used as a reverse proxy as well](http://httpd.apache.org/docs/2.2/mod/mod_proxy.html). – Giacomo1968 Mar 14 '15 at 03:58
  • @heavyd could you give me a hight-level explanation how reverse proxy works? how come it doesn't require that ip address? Thanks! – qqibrow Mar 14 '15 at 05:43
  • I'm assuming the gateway box has access to both the internal and external networks. Any reverse proxy would need to be run on the gateway. – heavyd Mar 15 '15 at 07:20
  • @qqibrow re what a reverse proxy is http://stackoverflow.com/questions/224664/difference-between-proxy-server-and-reverse-proxy-server – barlop Mar 15 '15 at 08:05
  • Why can't you use NAPT port forwarding on your gateway? btw, were you planning on running that socat line on an external server? also, socat aside, You could use this line from your internal server to external server 5.6.7.8 ssh -R 8080:127.0.0.1:8080 user@5.6.7.8 (format is PORT1:IP2:PORT2 user@IP1 that'd solve it4you.PORT1 is the port that will open listening on the comp you r calling ur external server.IP2:PORT2 is where2forward once it reaches the internal server i.e. forward it nowhere really(2itself).IP1 is'ext server'.The first but I am interested in other solutions though..!like socat! – barlop Mar 15 '15 at 08:48
  • @barlop u are right. the ssh tunnel works. :) the right solution is in this post: http://superuser.com/questions/588591/how-to-make-ssh-tunnel-open-to-public – qqibrow Mar 16 '15 at 01:18

0 Answers0