Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to use my server as a "proxy" with ssh. However, setting up tunneling with

ssh -D localhost:8000 user@myserver

does not work.

I tested this on various machines with ssh and putty - It connects just fine, but when I set my browser settings accordingly, I just get an error "Connection has been reset". I tried monitoring the traffic with wireshark, but I didn't even see some tunnel-traffic. I explicitly set AllowTcpForwarding to "yes" but I still can't use the tunnel.

When running ssh in verbose mode, I don't get any errors but

debug1: Connection to port 8000 forwarding to socks port 0 requested.
debug1: channel 3: new [dynamic-tcpip]
debug1: channel 3: free: dynamic-tcpip, nchannels 4

What am I doing wrong?

share|improve this question
I suspect that you config your browser at HTTP Proxy line instead of SOCKS host. –  quanta Sep 15 '12 at 13:32
I always made sure to set the SOCKS option, no matter which browser I was using. –  s1ck Sep 15 '12 at 13:45
Can you do tcpdump at the server (root/sudo access)? Pick an IP address reveal page, get it's IP address, watch that IP for traffic at the server, and try to visit it from your browser. FYI, the OP's ssh command works for me, from my desktop to my remote server. –  Skaperen Sep 15 '12 at 19:26
Hi! I already tried capturing with wireshark and it turns out that data never arrives at the server. When loading pages with the proxy activated, just no packets are sent at all. How could that be? –  s1ck Sep 23 '12 at 18:17
add comment

1 Answer

The correct command is:

ssh user@server -D 8000

In the case you still can't connect check if another process is using this port. The most easy way to do this is with:

netstat --listen |grep 8000

If that is the case just use another port.

share|improve this answer
this doesn't work either. "Connection Reset", same thing –  s1ck Sep 15 '12 at 13:15
will update my answer –  Lucas Kauffman Sep 15 '12 at 13:17
I made sure to use unused ports. I tried different ones, still the same. I am also running the ssh client as root, so permissions are not a problem, either. –  s1ck Sep 15 '12 at 13:25
you shouldn't be running it as root for other reasons, but I'm really baffled a bit. Do you have any iptables running on your server? –  Lucas Kauffman Sep 15 '12 at 13:31
No iptables whatsoever, neither on the server nor client-side –  s1ck Sep 15 '12 at 13:45
show 5 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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