LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-28-2005, 09:34 PM   #1
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Rep: Reputation: 31
ssh port forwarding question


Is there a way that I can port forward an ssh connection to another machine on my network?

I would like to ssh into my machine at home that has 22 open on my router and then be able to open another terminal and ssh to any other machine on my local network at home through my already open ssh connection.

I created an ssh script that had something to this affect:

-L 6000:IP ADDRESS OF MACHINE ON HOME NETWORK:22

If that is supposed to work then maybe I am not typing my ssh command properly. If that is so can anyone tell me how to ssh to a specific port?

Thanks for the help.
 
Old 09-28-2005, 09:51 PM   #2
slackhack
Senior Member
 
Registered: Jun 2004
Distribution: Arch, Debian, Slack
Posts: 1,016

Rep: Reputation: 47
port 22 is the default, so you don't have to specify it. if you change the sshd port number, you specify it with -p, for example:

$ ssh -l user IP -p 1234
 
Old 09-29-2005, 07:52 AM   #3
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Original Poster
Rep: Reputation: 31
So if Im specifying that ssh command is that something I do once I am authenticated to my home network from another terminal or is that something I change in my ssh script?
 
Old 09-29-2005, 02:29 PM   #4
ckeswani
LQ Newbie
 
Registered: Sep 2005
Posts: 10

Rep: Reputation: 0
Quote:
I would like to ssh into my machine at home that has 22 open on my router and then be able to open another terminal and ssh to any other machine on my local network at home through my already open ssh connection.

I created an ssh script that had something to this affect:

-L 6000:IP ADDRESS OF MACHINE ON HOME NETWORK:22

If that is supposed to work then maybe I am not typing my ssh command properly. If that is so can anyone tell me how to ssh to a specific port?
From the command line, you can type in
Code:
ssh -L 6000:IP ADDRESS OF MACHINE ON HOME NETWORK:22 username@home_external_ip
Then, from another terminal, you can do
Code:
ssh -p 6000 username@localhost
and your connection will automatically be forwarded to port 22 on IP ADDRESS OF MACHINE ON HOME NETWORK.

If you see an error about a host key having changed, let me know and we'll work through that.
 
Old 09-29-2005, 02:32 PM   #5
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Original Poster
Rep: Reputation: 31
I didn't see the error about the host key changing and everything worked well. Thank you for all of your help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH Port forwarding WRSpithead Linux - Networking 1 04-18-2005 04:09 AM
ssh port forwarding (tunneling?) question podollb Linux - Software 4 10-20-2004 01:12 AM
A little question to an SSH guru (port forwarding) J_Szucs Linux - Software 3 11-01-2003 07:59 AM
Ssh port forwarding? J_Szucs Linux - Networking 1 10-29-2003 04:42 AM
ssh, and port forwarding Tricky Linux - Networking 3 01-06-2003 07:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration