So I am having this remote machine, which is actually just a machine in the local network. I am running a Jupyter Notebook on that machine to which I was always able to access it via URL such as http://192.168.111.242/?token=asdfghjkl
However, lately this is not working for me and what I have to do is user port forwarding in order to make it work:
ssh -f username@name -L PORT:localhost:PORT -N
Otherwise, accessing http://192.168.111.242/?token=asdfghjkl will give me a ERR_CONNECTION_REFUSED
in my browser.
I don't quite understand why I have to forward the port here.
What could be the reason?
By default jupyter only binds to the localhost interface, so it can be used only from the local machine by connecting to
127.0.0.1
. If you want to make it available on your network, you have to tell it to listen to the external IP address of your machine, or simply to all IP addresses available:This way you do not need to create a port fowarding to access your jupyter notebook.
However, keep in mind that using an ssh tunnel probably provides better security than letting jupyter listen on your network. In addition, the connection through the ssh tunnel would be encrypted, while the direct connection to jupyter most likely would not. It pretty much depends on how much you trust your network. If it is not 100% trustable consider using the ssh tunnel solution.