Ok, here is the setup. I'm outside the local network and connecting to my home network using iSSH (on iPad), so far so good, I used to redirect my home mediacenter to localhost by creating a tunnel . So I can enter localhost:8080 in my address bar and browse my mediacenter at home, it was:

local port : 8080
destination host : localhost
destination port 8080

That worked well.

Now I would like to go a step further and tell the mediacenter I'm connecting to, to redirect 192.168.1.112:8800, that's the machine I'd like to access from the mediacenter and basically use the mediacenter as a gateway. I assume I'd have to use ssh -L but I`m not too sure if it's the right way to go about it.

How do I create this tunnel?

link|improve this question
could anybody follow up on how to do ssh tunneling with iSsh? The answers are perfectly clear if I'm working on my Mac/pc from a terminal, but I'm not sure how you actually do this on the iPad. I should add that I don't have an iSsh yet, and I would be glad to install it if I can use it to make a ssh tunnel to open a vnc session on a machine that is on my university private network. Thanks, Maurizio – user88612 Jul 2 '11 at 22:10
feedback

3 Answers

up vote 2 down vote accepted

I'm using bold to differentiate between the local port your connecting to on your ipad (in bold) and the remote port your accessing on your mediacenter (not bold).

It looks like this is what you have been doing:

ssh -L 8080:localhost:8080 username@YourMediaCenterPublicAddress.com

The "-L 8080:" means that your going to be taking a remote resource and binding it to a local port (in this case 8080) which means you can connect to this remote resource by typing in localhost:8080 on your ipad. the next part "localhost:8080" (from the perspective of the media center) is the hostname and port who's resources your binding to port 8080 on your ipad. You can change this to any hostname or ip-address and port that your media center can see on its network.

Now that you want to connect to 192.168.1.112:8800 it will look like this:

ssh -L [aLocalPort]:192.168.1.112:8800 username@YourMediaCenterPublicAddress.com

then you can connect to 192.168.1.112:8800 by typing in localhost:[aLocalPort] into whatever program you want to use to connect to it on your ipad. (where [aLocalPort] is some un-used local port like 9000. You can use the same port that is used on the destination (8800) for convenience if you like)

link|improve this answer
it worked perfectly, thanks – Julz May 25 '11 at 10:32
feedback

Yes you can add -L 192.168.1.112:8800, it will bind a port on your local machine (the client I mean) to the tunnel and will be forwarded by the remote server to the specified address and port.

link|improve this answer
feedback

Not really an answer, but using autossh instead of plain ssh is a good idea for tunnels, it reestablishes the tunnel automatically if there is a timeout etc (provided you have setup your ssh keys)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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