wgcampbell
Posts: 13
Joined: Mon Jun 11, 2012 7:25 pm

Temporarily redirect a port forward

Wed Nov 15, 2017 6:45 pm

I have a remote server on a remote network in a vacation house location. The router is presently forwarding port 8765 to port 8765 on a remote network pi. The sshd daemon on the pi is set up to accept both port 22 & 8765 connections.

On the above remote network pi, there is a web application I'd like to access. Port 8765 is the only port I have forwarded on the router and I do not have remote access to the router. Also it is many miles away and not possible (at this time) to access it locally.

Is there a way I could set up a temporary redirection (port 8765 to 80) on my remote network pi to allow me to use my remote pi web application?

B.Goode
Posts: 4689
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Temporarily redirect a port forward

Wed Nov 15, 2017 7:31 pm

Not answering your question about temporary redirection directly, but a couple of other thoughts.

1) You have ssh access to the remote RPi. Does the RPi have administrator access to its local router? Because if so you could use that to modify the port forwarding configuration of the router.

2) Again using the ssh connection to the remote RPi. Run an XWindows server on your local (where you are now) workstation, and enable X-windows forwarding on the ssh connection. Now you can start a browser on the remote RPi and have it rendered on the display in front of you. Then you can access the target web application from the browser simply accessing what it thinks is its localhost.


Good luck...

wgcampbell
Posts: 13
Joined: Mon Jun 11, 2012 7:25 pm

Re: Temporarily redirect a port forward

Wed Nov 15, 2017 7:54 pm

1) You have ssh access to the remote RPi. Does the RPi have administrator access to its local router? Because if so you could use that to modify the port forwarding configuration of the router.
If I was sitting at the remote pi, yes I would be able to configure the router through a web interface. The remote router does not accept a local or remote ssh connection.
2) Again using the ssh connection to the remote RPi. Run an XWindows server on your local (where you are now) workstation, and enable X-windows forwarding on the ssh connection. Now you can start a browser on the remote RPi and have it rendered on the display in front of you. Then you can access the target web application from the browser simply accessing what it thinks is its localhost.
This looks more promising - I'm not sure of the specifics of what you're suggesting, but I will Google around and try to figure it out.

B.Goode
Posts: 4689
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Temporarily redirect a port forward

Wed Nov 15, 2017 8:31 pm

If I was sitting at the remote pi, yes I would be able to configure the router through a web interface.
Just a variation on Idea 2. Get a browser running on the remote RPi, then use that to browse to the 'local' Admin Interface of the 'remote' router.


Another possible solution, if the remote RPi has unfettered outbound access to the internet, is to use a third-party 'reverse ssh tunnel' service such as those offered by Weaved or Dataplicity.

wgcampbell
Posts: 13
Joined: Mon Jun 11, 2012 7:25 pm

Re: Temporarily redirect a port forward

Thu Nov 16, 2017 3:53 am

Another possible solution, if the remote RPi has unfettered outbound access to the internet, is to use a third-party 'reverse ssh tunnel' service such as those offered by Weaved or Dataplicity.
"Weaved" looks really interesting.

X11 forwarding with Putty and Xming worked, but was shaky, jerky, and slow at best.

The best solution so far was to set up a ssh reverse tunnel (from the remote server). Much like this:

Code: Select all

timeout 600 ssh -R local_ssh_server_ip:8765:remote_router_local_ip:80 user@local_ssh_server.com &
The "timeout" satisfies the "temporary" requirement and browser response is very good.

Thanks for your help in getting me started.

mfa298
Posts: 1002
Joined: Tue Apr 22, 2014 11:18 am

Re: Temporarily redirect a port forward

Thu Nov 16, 2017 10:49 am

wgcampbell wrote:
Wed Nov 15, 2017 6:45 pm
I have a remote server on a remote network in a vacation house location. The router is presently forwarding port 8765 to port 8765 on a remote network pi. The sshd daemon on the pi is set up to accept both port 22 & 8765 connections.

On the above remote network pi, there is a web application I'd like to access. Port 8765 is the only port I have forwarded on the router and I do not have remote access to the router. Also it is many miles away and not possible (at this time) to access it locally.

Is there a way I could set up a temporary redirection (port 8765 to 80) on my remote network pi to allow me to use my remote pi web application?
An SSH Tunnel would probably achieve what you want. For the Linux SSH client something like "-L 8080:localhost:80" on the command line would set it up, From putty use something like 8080 as source port and localhost:80 as the destination. This will make the ssh session listen on the local port (8080) and then connect to the remote part (localhost:80) from the other end. You can then point your browser at localhost:8080 to connect to the remote webserver.

It should also be possible to set the destination part to <router.ip>:80, and access the routers web interface from your local browser on localhost:8080

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 22 guests