title: Google Dataproc - Unable to connect via SSH
body: <p>I installed a Cloud Datalab notebook on a Cloud Dataproc cluster following the instructions listed in the <a href="https://cloud.google.com/dataproc/docs/tutorials/dataproc-datalab" rel="nofollow noreferrer">official documentation</a></p>
  
  <p>After creating the cluster, I then created a SSH tunnel to the master node in the Cloud Shell and connected to the cluster interface using the Cloud Shell. <a href="https://cloud.google.com/dataproc/docs/concepts/accessing/cluster-web-interfaces#create_an_ssh_tunnel" rel="nofollow noreferrer">Instructions</a>. I could access the Jupyter notebooks after this. I used the <code>-v</code> verbose option to see the SSH connection logs:</p>
  
  <pre><code>gcloud compute ssh cluster-datalab-m --project=abcxyz-123 --zone us-west1-a \
      -- -v -4 -N -L 8080:cluster-datalab-m:8080
  </code></pre>
  
  <p>But after some time, I got a popup saying "A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration." and my cluster stopped responding to any commands.</p>
  
  <p>When I looked at the SSH output on the Cloud Shell, I saw that multiple channels were being requested at this point.</p>
  
  <p>A preview of SSH logs just during the break point:</p>
  
  <pre><code>debug1: channel 1: new [direct-tcpip]
  debug1: Connection to port 8080 forwarding to cluster-datalab-m port 8080 requested.
  debug1: channel 2: new [direct-tcpip]
  debug1: channel 1: free: direct-tcpip: listening port 8080 for cluster-datalab-m port 8080, connect from 127.0.0.1 port 52832 to 127.0.0.1 port 8080, nchannels 3
  debug1: channel 2: free: direct-tcpip: listening port 8080 for cluster-datalab-m port 8080, connect from 127.0.0.1 port 52833 to 127.0.0.1 port 8080, nchannels 2
  debug1: Connection to port 8080 forwarding to cluster-datalab-m port 8080 requested.
  debug1: channel 1: new [direct-tcpip]
  debug1: Connection to port 8080 forwarding to cluster-datalab-m port 8080 requested.
  debug1: channel 2: new [direct-tcpip]
  debug1: channel 2: free: direct-tcpip: listening port 8080 for cluster-datalab-m port 8080, connect from 127.0.0.1 port 52837 to 127.0.0.1 port 8080, nchannels 3
  debug1: Connection to port 8080 forwarding to cluster-datalab-m port 8080 requested.
  debug1: channel 2: new [direct-tcpip]
  debug1: Connection to port 8080 forwarding to cluster-datalab-m port 8080 requested.
  debug1: channel 3: new [direct-tcpip]
  debug1: Connection to port 8080 forwarding to cluster-datalab-m port 8080 requested.
  debug1: channel 4: new [direct-tcpip]
  debug1: Connection to port 8080 forwarding to cluster-datalab-m port 8080 requested.
  debug1: channel 5: new [direct-tcpip]
  debug1: Connection to port 8080 forwarding to cluster-datalab-m port 8080 requested.
  debug1: channel 6: new [direct-tcpip]
  debug1: Connection to port 8080 forwarding to cluster-datalab-m port 8080 requested.
  </code></pre>
  
  <p>I closed this SSH connection manually and then tried to SSH into the master node by clicking the <code>SSH</code> button on the Compute Engine console but even that was taking lot of time and didn't complete successfully.</p>
  
  <p>I looked at this <a href="https://stackoverflow.com/questions/26813070/google-compute-engine-getting-blocked-after-accessing-ssh-a-few-times">stackoverflow question</a> but I couldn't find any <code>/etc/sshguard</code> folder in the master node so I don't think that is the issue for my case. The master node was running Debian 8.10.</p>
  
  <p>Is there any way to ensure that the SSH connection (and the Jupyter notebook) works continuously?</p>