title: Debug port forwarding for using Jupyter notebook remotely
body: <p>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., <code>gateway.myuniv.edu</code>). Once I am logged to <code>gateway.myuniv.edu</code>, I can ssh to the computer on which I would like to run the Jupyter notebook server (e.g. <code>cluster.myuniv.edu</code>). </p>
  
  <p><strong>What works</strong>: I can run the server on the gateway and connect to it from my laptop using local port forwarding, as follows:</p>
  
  <p>On <code>gateway.myuniv.edu</code>: <code>$ jupyter notebook --no-browser --port 8888</code></p>
  
  <p>On my laptop: <code>$ ssh -v -N -L 9000:localhost:8888 myusername@gateway.myuniv.edu</code></p>
  
  <p>Then on my laptop's browser, I open the url: <code>http://localhost:9000</code></p>
  
  <p><strong>What doesn't work</strong>: 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:</p>
  
  <p>On <code>cluster.myuniv.edu</code>: <code>$ jupyter notebook --no-browser --port 8888</code></p>
  
  <p>On my laptop: <code>$ ssh -v -N -L 9000:cluster.myuniv.edu:8888 myusername@gateway.myuniv.edu</code></p>
  
  <p>Then on my laptop's browser, I open the url: <code>http://localhost:9000</code>. This doesn't work: SSH says that the connection is refused.</p>
  
  <p>I don't understand why this would happen and how to debug this, would be happy for any help. Thanks!</p>