I am attempting to forward local port 8000 on a Windows 10 machine to port 8888 on a remote Ubuntu server on EC2, so that I can access and edit jupyter notebooks on the server from my local machine. It worked the first time I made the connection, but I've been getting Forwarded connection refused by server
messages ever since. I'm forwarding the port via PuTTY on the local machine, and the server is running Ubuntu 16.04. Can anyone help me understand why it stopped working?
I configured my jupyter notebook server as described here: https://hackernoon.com/aws-ec2-part-4-starting-a-jupyter-ipython-notebook-server-on-aws-549d87a55ba9
Once jupyter was installed, I started the notebook server with the following command:jupyter notebook --no-browser --port=8888
I then launched PuTTY and forwarded local port 8000 to remote port 8888, and navigated to localhost:8000/ from a browser on my local machine, but the browser says the site can't be reached.
This is the output of sudo iptables -L
on my server:
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Below is an excerpt of PuTTY's Event Log when I tried to connect to http://localhost:8000/ from my local machine
2018-06-06 21:12:58 Forwarded port closed due to local error: Network error: Software caused connection abort
2018-06-06 21:12:59 Forwarded port closed due to local error: Network error: Software caused connection abort
2018-06-06 21:13:48 Opening connection to XX.XX.XX.XXX:8888 for forwarding from [::1]:50416
2018-06-06 21:13:48 Opening connection to XX.XX.XX.XXX:8888 for forwarding from [::1]:50417
2018-06-06 21:15:56 Forwarded connection refused by server: Connect failed [Connection timed out]
2018-06-06 21:15:56 Forwarded connection refused by server: Connect failed [Connection timed out]
2018-06-06 21:15:56 Opening connection to XX.XX.XX.XXX:8888 for forwarding from [::1]:50456
2018-06-06 21:18:03 Forwarded connection refused by server: Connect failed [Connection timed out]
2018-06-06 21:18:03 Opening connection to XX.XX.XX.XXX:8888 for forwarding from [::1]:50488
2018-06-06 21:18:03 Opening connection to XX.XX.XX.XXX:8888 for forwarding from [::1]:50489
Answer
I found a clue here: https://superuser.com/questions/1212678/windows-10-putty-something-blocks-port-tunnel
I was forwarding local port 8000 to the global IP address of the server, when I should have been forwarding to loopback address 127.0.0.1. Making that change in the PuTTY connection configuration solved my problem.
I'm not sure why I can't forward to the global IP address, and if anyone can explain, I'd appreciate your input.
No comments:
Post a Comment