How to debug a ssh tunnel
I want to setup a simple ssh tunnel from a local machine to a machine on the internet. I'm using
ssh -D 8080 -f -C -q -N -p 12122 <username>@<hostname>
Setup works fine (I think) cause ssh returs asking for the credentials, which I provide.
Then i do
export http_proxy=http://localhost:8080
and
wget http://www.google.com
Wget returns that the request has been sent to the proxy, b开发者_JAVA技巧ut no data is received back. What i need is a way to look at how ssh is processing the request....
To get more information out of your SSH connection for debugging, leave out the -q
and -f
options, and include -vvv
:
ssh -D 8080 -vvv -N -p 12122 <username>@<hostname>
To address your actual problem, by using ssh -D
you're essentially setting up a SOCKS proxy which I believe is not supported by default in wget.
You might have better luck with curl
which provides SOCKS suport via the --socks
option.
If you really really need to use wget, you'll have to recompile your own version to include socks support. There should be an option for ./configure
somewhere along the lines of --with-socks
.
Alternatively, look into tsock which can intercept outgoing network connections and redirecting them through a SOCKS server.
精彩评论