How to debug a ssh tunnel

余生颓废 提交于 2019-12-04 20:38:45

问题


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, but no data is received back. What i need is a way to look at how ssh is processing the request....


回答1:


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.



来源:https://stackoverflow.com/questions/4992464/how-to-debug-a-ssh-tunnel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!