Issue
I am trying to use Jupyter notebook on a remote computer. The setup is as follows: I have my home laptop, which can ssh to a specific computer on my university's network (e.g., gateway.myuniv.edu
). Once I am logged to gateway.myuniv.edu
, I can ssh to the computer on which I would like to run the Jupyter notebook server (e.g. cluster.myuniv.edu
).
What works: I can run the server on the gateway and connect to it from my laptop using local port forwarding, as follows:
On gateway.myuniv.edu
: $ jupyter notebook --no-browser --port 8888
On my laptop: $ ssh -v -N -L 9000:localhost:8888 [email protected]
Then on my laptop's browser, I open the url: http://localhost:9000
What doesn't work: I don't want to run the server on the gateway, since I can't do heavy computations there. I tried to do the following:
On cluster.myuniv.edu
: $ jupyter notebook --no-browser --port 8888
On my laptop: $ ssh -v -N -L 9000:cluster.myuniv.edu:8888 [email protected]
Then on my laptop's browser, I open the url: http://localhost:9000
. This doesn't work: SSH says that the connection is refused.
I don't understand why this would happen and how to debug this, would be happy for any help. Thanks!
Solution
The issue is that you are forwarding port :8888
on cluster.myuniv.edu
to port :9000
on gateway.myuniv.edu
and then forwarding port :8888
on gateway.myuniv.edu
to port 9000
on your laptop.
The solution would the following:
On cluster.myuniv.edu: $ jupyter notebook --no-browser --port 8888
On gateway.myuniv.edu: $ ssh -v -N -L 8888:localhost:8888 [email protected]
On laptop: $ ssh -v -N -L 9000:localhost:8888 [email protected]
I would also recommend that you run Jupyter notebook (on the cluster) and the ssh tunneling (on the gateway) using Tmux or Screen so it remains active even if you close terminal
Answered By - Andrew Andrade Answer Checked By - Dawn Plyler (WPSolving Volunteer)