Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remote debugging - how to create a port proxy?

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     
like image 459
Konrad Dzwinel Avatar asked Aug 23 '12 08:08

Konrad Dzwinel


2 Answers

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/
like image 52
Konrad Dzwinel Avatar answered Oct 07 '22 09:10

Konrad Dzwinel


The browser binds socket to localhost address. That is why you have the problem with accessing to the port.

You can solve the problem with help of ssh port forwarding feature.

ssh [email protected] -L 9111:127.0.0.1:9222

After running this command please open localhost:9111 on host B

ssh will forward the connection to host A and connect it to localhost:9222

like image 27
loislo Avatar answered Oct 07 '22 07:10

loislo