如何调试ssh隧道 [英] How to debug a ssh tunnel
问题描述
我想在本地机器上设置一个简单的ssh隧道到互联网上的机器。
我正在使用
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>
安装工作正常(我认为)导致ssh重新提交我提供的凭据。
Setup works fine (I think) cause ssh returs asking for the credentials, which I provide.
然后我执行
export http_proxy = http:// localhost:8080
和
wget http://www.google.com
Wget返回请求已发送到代理,但没有收到数据。
我需要的是一种方法来查看ssh如何处理请求....
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....
推荐答案
要获取您的SSH连接中有更多信息进行调试,请忽略 -q
和 -f
选项,并包含 -vvv
:
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>
要解决您的实际问题,请使用 ssh -D
您本质上是设置了一个 SOCKS 代理,我认为默认情况下不支持wget。
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.
您可能会喜欢 curl
,通过 - 袜子提供SOCKS suport
选项。
You might have better luck with curl
which provides SOCKS suport via the --socks
option.
如果您真的需要使用wget,则必须重新编译自己的版本以包含袜子支持。在 - with-socks
之间的某个地方,应该有 ./配置
的选项。
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
.
或者,查看 tsock 它可以拦截传出的网络连接并通过SOCKS服务器重定向它们。
Alternatively, look into tsock which can intercept outgoing network connections and redirecting them through a SOCKS server.
这篇关于如何调试ssh隧道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!