Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 07-24-2011, 07:26 PM   #1
Registered: Jan 2011
Posts: 83

Rep: Reputation: 11
About SSH Tunneling


I want to do ssh tunneling. I went to youtube and saw some videos on the subject.

I'm a bit confused...

Some people use the -L and others used -D with ssh. Do these switches do the same thing?

BTW, I edited three lines from the /etc/ssh/sshd_config file. I change the port number and I removed the hash mark from the two lines below.

AllowTcpForwarding yes
PermitTunnel yes

Is this enough to do ssh tunneling?
Old 07-24-2011, 10:46 PM   #2
Registered: Jul 2009
Distribution: Slackware
Posts: 100

Rep: Reputation: 39
It should do the trick. I believe -D is for establishing a local port to forward over. The -R switch will establish a port on the remote server.
Normally (assuming you are initiating the ssh connection from the machine you want to tunnel from) you will want the -D switch.
Old 07-25-2011, 01:50 AM   #3
Senior Member
Registered: Oct 2004
Posts: 1,192

Rep: Reputation: 101Reputation: 101
Originally Posted by man ssh
-D ...
Whenever a connection is made to this port, the connec‐
tion is forwarded over the secure channel, and the application protocol is then
used to determine where to connect to from the remote machine. Currently the
SOCKS4 and SOCKS5 protocols are supported, and ssh will act as a SOCKS server.
Only root can forward privileged ports. Dynamic port forwardings can also be
specified in the configuration file.
If you use -D then you need a SOCKS proxy aware app. For ssh you can use connect-proxy. On the plus side you don't need to set up explicit tunnels for every ssh connection you want to go through that server. You can also use it to proxy web/email/any other traffic you care through it.

-L binds a specific remote address and port to a local port. It is a little more convenient to setup, you simply connect to the local port as you would the remote one, but it is less flexible, ie you have to explicitly set up each tunnel
Old 07-25-2011, 09:34 AM   #4
Registered: Jan 2011
Posts: 83

Original Poster
Rep: Reputation: 11
Thanks sysfce2 and phil.d.g for your feedback. I'm less confused now


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH tunneling entz Linux - Networking 3 04-04-2007 07:22 AM
tunneling thru ssh c9876543210 Linux - Networking 1 07-21-2005 12:45 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
tunneling with ssh barbanero Linux - Security 2 01-24-2002 10:53 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:05 PM.

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