You are not logged in.

#1 2011-02-28 22:36:18

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Playing with tunneling....

I have a ssh server in my remote work that I can access from home via 123.456.789:2203

Sometimes, i want to connect from my home to a port on an specific machine inside the work network.... I think this is what ssh tunneling is for....

So far, I managed to connect to the ssh server's ports:

ssh -N -p 2203 administrator@123.456.789 -L 3385/localhost/3385

But if i try to connect to the machine in the remote network's IP 192.168.1.1, this command:

ssh -N -p 2203 administrator@123.456.789 -L 3385/192.168.1.1/3385

does not work...... what am i doing wrong?

Offline

#2 2011-02-28 23:32:51

oliver
Member
Registered: 2007-12-12
Posts: 448

Re: Playing with tunneling....

ports should be specified with a : not a /

Try something like:

ssh -N administrator@123.456.789:2203  -L 3385:localhost:3385

Offline

#3 2011-03-05 20:56:37

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Re: Playing with tunneling....

oliver wrote:

ports should be specified with a : not a /

Try something like:

ssh -N administrator@123.456.789:2203  -L 3385:localhost:3385

That does not work for me..... strange... i will try more things... if somebody else has some idea it would be much appreciated

Offline

#4 2011-03-05 21:06:21

rickdg
Member
From: The Lowlands
Registered: 2011-01-01
Posts: 24

Re: Playing with tunneling....

Xi0N wrote:
oliver wrote:

ports should be specified with a : not a /

Try something like:

ssh -N administrator@123.456.789:2203  -L 3385:localhost:3385

That does not work for me..... strange... i will try more things... if somebody else has some idea it would be much appreciated

if you copy-pasted that command, the problem is probably a few missing digits in the IP adress. The -L localport:adresss:remoteport works fine for me.

Offline

#5 2011-03-05 21:09:12

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Re: Playing with tunneling....

ssh: Could not resolve hostname xxx.xxx.xxx.xxx:2203: Name or service not known

That's what i get when i enter thae command for connecting....

Offline

#6 2011-03-06 06:02:17

oliver
Member
Registered: 2007-12-12
Posts: 448

Re: Playing with tunneling....

Xi0N wrote:
ssh: Could not resolve hostname xxx.xxx.xxx.xxx:2203: Name or service not known

That's what i get when i enter thae command for connecting....

Maybe ssh doesn't like hostname:port in the initial connection.  Try going back to using the -p 2203

ssh -N -p 2203 administrator@123.456.789  -L 3385:localhost:3385

Last edited by oliver (2011-03-06 06:04:33)

Offline

#7 2011-03-06 10:52:03

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Re: Playing with tunneling....

Ok, that works for the machine that has the ssh server but how to connect to another machine inside the same network?

ssh -N -p 2203 administrator@123.456.789  -L 3385:192.168.1.x:3385

Didnt work for me....

Offline

#8 2011-03-06 11:24:57

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: Playing with tunneling....

Are you sure it doesn't work? After executing that command, the remote port can be accessed through the tunnel by connecting with localhost:3385 (on the machine you create the tunnel).

Offline

#9 2011-03-06 11:29:03

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Re: Playing with tunneling....

Sorry... i was doing it wrong.... forgot that the prot gets mapped to your LOCALHOST port... so, instead of accessing the remote local ip like 192.168.1.x:444, i should do: localhost:444... my bad.... smile

Thanks... now i got it working!!!

Offline

#10 2011-03-06 12:53:11

hexanol
Member
From: Canaduh
Registered: 2009-08-04
Posts: 95

Re: Playing with tunneling....

You can also create real tunnel (VPN like) with OpenSSH and it's -w option. That said, if you only want to reach a specific port on a specific host, forwarding with the -L (or -R) option is simpler and is all that's needed. But if you're interested, see the man page for ssh, and search for the VPN word.

Offline

#11 2011-03-06 12:55:28

Xi0N
Member
From: Bilbao - Spain
Registered: 2007-11-29
Posts: 832
Website

Re: Playing with tunneling....

Yes, because what i want to do is sort of making my local machine like if it was inside the remote network......
I will have a look..... thanks!!

Offline

Board footer

Powered by FluxBB