Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

what I have is a "phone-home" service running at remote1 that connects to LAN1 via:

ssh -N -R 16864:localhost:22 <myuser.on.lan1>@<lan1.ip>

so from the SSH terminal on LAN1 I can easily load terminal on remote1 doing:

ssh -l <myuser.on.remote1> -p 16864 localhost

remote1 is running a daemon service with a web panel on port 9091 (Transmission).

So what I want is to connect to this web interface on port 9091 on remote1, through LAN1 (that already have a tunnel open on port 16864) from my local machine.

so probably this:

Local machine browser -> LAN1:16864 -> 22:REMOTE1:9091

I've been trying quite a few different SSL commands based on what I read HERE, HERE, HERE and the original setup is based on THIS

I've been trying stuff like this, but I'm sure I'm close but pretty lost on what to do:

ssh -t -L8080:localhost:5590 user@192.168.2.42 ssh -l user -p 16864 localhost -N

but of course, if I'm asking here it's because I'm failing miserably. Any expert to help me out on this one?

edit:

I don't have any diagrams but I'll explain in a different way:

I have 3 linux computers:

  • REMOTE1 always-on raspPi on remote location, which I don't have much access to network configuration
  • LAN1 always on raspPi on my local lan, where I can setup port-forwarding, fixed IP and dynamic DNS, without issues.
  • my PC, which I want to be able to access web services on REMOTE1

REMOTE1 is doing a "call home" to keep a SSH connection with LAN1 via:

ssh -N -R 16864:localhost:22 <myuser.on.lan1>@<lan1.ip>

and that part is working fine. I use my local machine terminal to SSH to LAN1, then inside LAN1 machine I type:

ssh -l <myuser.on.remote1> -p 16864 localhost

and I can do terminal stuff on REMOTE1.

Currently I only got a service on 9091 (transmission-daemon) but I'll be installing some other stuff later.

So the question, how do I tunnel from my local machine to access the web service on port 9091 on the REMOTE1 going through the tunneled connection on LAN1?

in a simplistic way:

  • local machine: ssh 8888 <magic> 1684 <magic> 9091 <magic> -N
  • open the browser on type localhost:8888/transmission/web/ and access it the transmission-daemon on REMOTE1
share|improve this question
    
I need pictures or something. I am not following what needs to go where. In any case, you probably should be using ProxyCommand ssh -W intermediate from the local machine so that you can build a single tunnel between the far host and local host. –  Zoredache Jun 23 at 23:29
    
thanks for the answer. I edited the question with some more details. I'll certain check it out ProxyCommand, thanks for the tip –  Budius Jun 24 at 0:02
    
I guess the biggest issue I have, is that most examples, have defined hostname/IP. And on my case, I have no idea on REMOTE1 hostname/IP, I need to simply re-use the existing permanent connection on port 16864 –  Budius Jun 24 at 0:16

1 Answer 1

up vote 1 down vote accepted

First set up so you can ssh from your PC "directly" to remote1:

In your .ssh/config put:

Host remote1
  Proxycommand ssh -q -l <myuser.on.lan1> lan1 nc -w 600 localhost 16864

Make sure netcat (nc command) is installed on lan1.

You should now be able to ssh from your pc with:

ssh <myuser.on.remote1>@remote1

once this works, use:

ssh -L8888:localhost:9091 <myuser.on.remote1>@remote1

and you have access to transmission on remote1:9091 via localhost:8888

share|improve this answer
    
Thanks for the answer. Sounds like it's what I need. I'll only be able to test it later tonight thou, I'll report back. –  Budius Jun 24 at 11:03
    
PERFECT!! =] at the end I'm using transmission on the same port it opens and I can use the same technique to expand to any other service I want to run remotely. That was my final command: ssh -L9091:localhost:9091 budius@remote -N (-N at the end to leave the ports open and I can access through the browser) –  Budius Jun 24 at 19:18

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.