SSH tunnel doesn't work
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?
Solution 1:
It's an old thread, but I think it's worth posting possible solution.
I had the same issue with several browsers and it turned out to be configuration issue. If that's the case, the following command should work and show IP address of remote machine:
links -socks-proxy localhost:8000 www.myipaddress.com
First comment on the question is correct in that browser might try to use HTTP proxy instead of SOCKS proxy, in which case I see exactly the same output from ssh
as in the OP's post. And although I did set SOCKS proxy the problem was that I didn't unset HTTP proxy. Once that was done, everything started working as expected.
Solution 2:
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.