远程调试 - 如何创建一个端口代理? [英] Remote debugging - how to create a port proxy?

查看:413
本文介绍了远程调试 - 如何创建一个端口代理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试访问框B(Windows)上的框A(Debian)上运行的远程调试端口。在框A我运行Chrome与 - 远程调试端口= 9222 标志,我可以看到它工作正常(我可以访问 localhost:9222 来自A上的其他浏览器)。另外,我确信框A和框B已连接,因为我可以从框B在框A上运行:80 (apache)。我现在需要做的是允许框B在框A上访问:9222 。我已经研究了端口转发和iptables规则,但是我未能使其工作。

编辑

机器B是Windows,所以我不知道如何在那里使用ssh,我发现一个应用程序用于端口转发,似乎工作正常。它虽然给我一个错误:收到一个连接,但无法连接到主机B:9222。所以它看起来像9222不开放外部连接。来自netstat on A的输出给我:

  root @ template:/ home / developer#netstat -nap | grep 9222 
tcp 0 0 127.0.0.1:9222 0.0.0.0:* LISTEN 24300 / user


解决方案

我在此处找到了我的答案。一切都归结于此:


  • 在一个控制台中打开Chrome: google-chrome --remote-debugging-port = 9222

  • 并在另一个代理中设置代理: ssh -L 0.0.0.0:9223:localhost:9222 localhost -N

  • 现在您应该可以通过 http://192.168.1.123:9223/


I'm trying to access remote debugging port running on box A (Debian) from box B (Windows). On box A I'm running Chrome with --remote-debugging-port=9222 flag and I can see that it works correctly (I can access localhost:9222 from another browser on A). Also, I'm sure that boxes A and B are connected because I can access :80 (apache) running on box A from box B just fine. Thing I need to do now is to allow box B access :9222 on box A. I've done research on port forwarding and iptables rules but I failed to make it work.

EDIT

Machine B is Windows so I'm not sure how to use ssh there, I found an app for port-forwarding that seems to work fine. It gives me an error though: "received a connection but can't connect to host-B:9222". So it looks like 9222 is not open for outside connections. Output from netstat on A gives me:

root@template:/home/developer# netstat -nap | grep 9222
tcp        0      0 127.0.0.1:9222      0.0.0.0:*    LISTEN      24300/user     

解决方案

I found my answer here. Everything comes down to this:

  • open Chrome in one console: google-chrome --remote-debugging-port=9222
  • and set up a proxy in another one: ssh -L 0.0.0.0:9223:localhost:9222 localhost -N
  • now you should be able to access remote debugging from another machine via http://192.168.1.123:9223/

这篇关于远程调试 - 如何创建一个端口代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆