Following these instructions (Running a notebook server and Remote access to IPython Notebooks ) I proceed as follows:
On the remote server:
1) Setting NotebookApp.password()
In [1]: from IPython.lib import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
2) Create profile
user@remote_host$ ipython profile create
3) Edit ~/.ipython/profile_default/ipython_notebook_config.py
# Password to use for web authentication
c = get_config()
c.NotebookApp.password =
u'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
4) Start notebook on port 8889
user@remote_host$ ipython notebook --no-browser --port=8889
and the notebook starts
[I 16:08:10.012 NotebookApp] Using MathJax from CDN:https://cdn.mathjax.org/mathjax/latest/MathJax.js
[W 16:08:10.131 NotebookApp] Terminals not available (error was No module named 'terminado')
[I 16:08:10.132 NotebookApp] Serving notebooks from local directory: /cluster/home/user
[I 16:08:10.132 NotebookApp] 0 active kernels
[I 16:08:10.132 NotebookApp] The IPython Notebook is running at: http://localhost:8889/
[I 16:08:10.132 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
On my local machine
5) SSH tunneling
user@local$ ssh -N -f -L localhost:8888:127.0.0.1:8889 username@remote_host
On the remote host (/etc/hosts) you find
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
6) Finally, I try to open localhost:8888 on my browser, and I get:
channel 2: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
All these steps work on one server, but fail on another one.
I tried contacting the administrator and said the following:
I assume that you are using two separate SSH connections: one from which you run ipython and one that you use to do port forwarding. There is no guarantee that the two connections will land you on the same login node. In the case where the two connections are on different hosts, you will experience the exact failure you have encountered. Therefore you should setup the port forwarding in the connection that you use to run ipython.
How can I setup the port forwarding in the connection that I use to run ipython?
I tried using my ip address but it didn't work
$ ssh -N -f -L local_ip_address:8888:127.0.0.1:8889 user@remote_host