我可以使用 http 隧道通过带有防火墙的代理进行 ping 或跟踪路由吗?

发布于 2024-10-16 07:53:16 字数 322 浏览 4 评论 0原文

我不知道是否有一种方法可以 ping 我的 LAN 代理之外的目标,该代理仅通过鱿鱼代理接受 Http 请求...我在某处读到,处理此类问题的一种方法是使用 http 隧道,以便proxy 仍然将请求视为 Http 请求。我可以使用它来 ping,例如 www.google.com,否则会给出以下错误,因为防火墙拒绝请求:

$ ping www.google.com
ping: unknown host www.google.com

如果是这样,它是如何完成的...?

我已经安装了 httptunnel。任何有关如何使用它的帮助将不胜感激。

I don't know if there is a way to ping a target outside my LAN proxy which accepts only Http requests through a squid proxy... I read somewhere that one way to deal with such problem is to use a http tunnel so that the proxy still sees the request as a Http request. Can I use this to ping,say, www.google.com which otherwise is giving the following error because the firewall is rejecting the request:

$ ping www.google.com
ping: unknown host www.google.com

If so how is it done...?

I have installed httptunnel.Any help in how to use it will be much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风蛊 2024-10-23 07:53:16

不可以。Ping 和 Traceroute 使用较低层网络协议(特别是 ICMP 和/或 UDP,它们是第 4 层协议),并且不能在 HTTP(第 7 层)隧道上工作。在任何情况下,即使您可以说服 HTTP 代理为您打开原始 TCP 会话(这就是某些 HTTP 隧道的工作原理),您也不会收到必要的数据包来确认主机可访问。 (在 ping 的情况下是 ICMP 回显回复,在跟踪路由的情况下是 ICMP 数据包的生存时间过期)

要测试这种情况下的连接,我认为最好的方法是 HTTP“ping”。 (尝试与远程主机建立 HTTP 连接,看看它是否有效。)例如,您可以执行以下操作:

$ http_proxy=http://webproxy.example.com:3128 \
> curl -I http://google.com/ > /dev/null 2>&1 \
> && echo success || echo failure

假设您安装了 curl,如果 google.com,这将打印“成功”可以通过您的代理访问,如果不能访问则“失败”。

No. Ping and traceroute make use of lower layer network protocols (ICMP and/or UDP, in particular, which are layer 4 protocols) and will not work over an HTTP (layer 7) tunnel. In any case, even if you could convince the HTTP proxy to open a raw TCP session for you (which is how some HTTP tunneling works) you would not receive the necessary packets to confirm that the host is reachable. (ICMP echo reply, in the case of ping, or the time-to-live expired ICMP packets in the case of traceroute)

To test for connectivity in this situation, I think the best you can do is an HTTP "ping". (Try to establish an HTTP connection with the remote host and see if it works.) For example, you could do something like:

$ http_proxy=http://webproxy.example.com:3128 \
> curl -I http://google.com/ > /dev/null 2>&1 \
> && echo success || echo failure

Assuming you have curl installed, this would print "success" if google.com is reachable through your proxy and "failure" if not.

婴鹅 2024-10-23 07:53:16

这并不完全是您想要的,但如果您可以访问外部 ssh 服务器,您可以通过它运行它,结果将反映 ssh 服务器的 ping 时间:

$ ssh username@server 'ping -c 1 google.com' 
PING google.com (72.14.204.147) 56(84) bytes of data.
64 bytes from iad04s01-in-f147.1e100.net (72.14.204.147): icmp_seq=1 ttl=57 time=2.64 ms

--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.640/2.640/2.640/0.000 ms 

It's not exactly what you were looking for, but if you can access and external ssh server, you can run it through that, and the results will reflect the ping time to the ssh server:

$ ssh username@server 'ping -c 1 google.com' 
PING google.com (72.14.204.147) 56(84) bytes of data.
64 bytes from iad04s01-in-f147.1e100.net (72.14.204.147): icmp_seq=1 ttl=57 time=2.64 ms

--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.640/2.640/2.640/0.000 ms 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文