What's the difference between using SOCKS (SSH -D) and local port forwarding (SSH -L)

link|improve this question

79% accept rate
feedback

1 Answer

With -L, SSH forwards all connections to a fixed destination. When you connect to the local port, all data you send goes straight to the remote host which you specified in -L. This, obviously, requires you to know which host you want to forward connections to.

With -D, the destination is "dynamic" – after connecting to the local port, you have to use the SOCKS proxy protocol to further connect to whatever remote host you want. This basically makes SSH a real proxy server, suitable for such activities as web browsing, where you cannot know in advance the destination.

Run ssh -D 1080, for example, and configure Firefox to use a SOCKS 5 proxy at localhost:1080.

link|improve this answer
I often use ssh -D 8080 myhomecomputer when I use my laptop on public wifi. – Evan Krall Jul 24 '11 at 8:35
feedback

Your Answer

 
or
required, but never shown

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