LinuxQuestions.org
Review your favorite Linux distribution.
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 10-16-2007, 08:09 AM   #1
kpenrose
LQ Newbie
 
Registered: Oct 2007
Posts: 3

Rep: Reputation: 0
SSH Tunneling


I have a need to open a tunnel occassionally from work to home. The only ports going to the outside world are 8080, 8081 and 8082. I'd like to be able to ssh to my home server, or possible use nomachine (nxclient) over this tunnel. I have opened those ports on my firewall at home. I've looked at the documentation and everything that I can find on the subject, but it's a little confusing since I can't find anyone who wants to do exactly what I'm asking.
HTTP tunneling is not an option for me, it's a little too unreliable and drops connections sporadically, causing entries into some system level log files...

Do I need to run an ssh server (on my home server) that listens to, say, 8080 and forwards to port 22? Is the setup only on the client?

Thanks in advance for your help.
 
Old 10-16-2007, 09:55 AM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
If I understand your situation correctly, all you need to do is have sshd (ssh server) on your home server listen on port 8080. When you make a connection, you then tell the ssh client to use that port instead of port 22. All of the normal options for ssh should work.
 
Old 10-16-2007, 10:00 AM   #3
kpenrose
LQ Newbie
 
Registered: Oct 2007
Posts: 3

Original Poster
Rep: Reputation: 0
That sounds like what I want - what would be the syntax for the server and the client calls to ssh?
There isn't any problem with ssh listening on one port and forwarding to port 22 (its normal listener)?
 
Old 10-16-2007, 11:08 AM   #4
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by kpenrose View Post
There isn't any problem with ssh listening on one port and forwarding to port 22 (its normal listener)?
What I described does not involve "forwarding to port 22." The server simply listens on a different port. It is possible to leave it listening on port 22 and forward the incoming connection to port 22, but unless you have a need to have the ssh server also listening on port 22, I would recommend just changing its listening port.

To do that, you need to edit /etc/ssh/sshd_config. You must do this as root, but you can use your favorite editor. Find the line that says

Port 22

and change 22 to the port you want to listen to. You must then restart sshd or, if you know what you are doing, sending the root sshd process a SIGHUP. If you connect using the ssh command, you can simply include the option -p 8080 along with any other options on the command line. You can also edit ~/.ssh/config ("~" just refers to your home directory). to include a Port statement like you did for the server, and it will use that port automatically unless you override it on the command line.

EDIT: What I described above for the server is correct if the server is directly connected to the Internet. If there is a "router" (more accurately a NAT device or hardware firewall) between the server and the Internet, then you must set the "router" up to do port forwarding. (Consult its manual on how to do this -- I can't advise.) In that case you can leave the server itself listenning on port 22 if you wish.

Last edited by blackhole54; 10-16-2007 at 11:40 PM.
 
Old 10-16-2007, 05:40 PM   #5
jymbo
Member
 
Registered: Jan 2003
Posts: 217

Rep: Reputation: 30
Quote:
Originally Posted by kpenrose View Post
I have a need to open a tunnel occassionally from work to home. The only ports going to the outside world are 8080, 8081 and 8082.
Do you mean you are you behind a proxy server? Open a terminal/command prompt and do "ping google.com". Do you get a response? If you don't get a response, then you are behind a proxy server. You can use NX to create a ssh tunnel through your proxy server at work to your machine at home.
 
  


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
Tunneling with ssh ssherman Linux - Networking 3 07-16-2007 02:13 AM
SSH tunneling entz Linux - Networking 3 04-04-2007 07:22 AM
X tunneling with SSH phekno Linux - Networking 3 05-31-2005 10:43 AM
SSH Tunneling danny_beta_read Linux - Networking 0 06-10-2004 02:43 PM
Tunneling through SSH rech Slackware 1 11-28-2003 08:21 PM

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

All times are GMT -5. The time now is 06:42 AM.

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