SSH tunnel to a certain node: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
Sun092 (talk | contribs)
No edit summary
Haars0011 (talk | contribs)
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
SSH tunnel to a certain node


1) Submit a slurm job, or start an interactive job on a node. Taking node201 as an example:
* Submit a slurm job, or start an interactive job on a node.
sinteractive --partition=main --nodelist=node201


2) In your local OS, set up a port tunnel connection (For example using port 2222):
sinteractive
ssh -L 2222:node201:22 your_id@login.anunna.wur.nl
or for a Nvidia A100 GPU:
sinteractive -p gpu --gres=gpu:1 --constraint='nvidia&A100'
*
* Check on which node this job has landed
squeue -u $USER -l
* Add this to your machines ssh config in ~/.ssh/config
Host node* gpu*
    Hostname      %h.internal.anunna.wur.nl
    ProxyJump      login.anunna.wur.nl
    User          your_user_id
Host *.anunna.wur.nl
    User          your_user_id


3) Config your local ssh config in ~/.ssh/config
* You can now use your local terminal connecting to e.g. node201 directly, by:
Host localhost
  HostName localhost
  Port 2222
  User your_id


4) You could now use your local terminal connecting to node201 directly, by:
ssh node201
ssh your_id@localhost -p 2222


5) VSCode connection: in the VSCode GUI -> Open a remote Window -> Connect to Host...,
* In VSCode :
choose "localhost". After a few seconds, the VSCode is connected to the node201.
in the VSCode GUI -> Open a remote Window -> Connect to Host...,type in the nodename. After a few seconds, VSCode is connected to the node.


Please be aware that once the slurm job finishes, the connection will be lost.
Please be aware that once the slurm job finishes, the connection will be lost and your running processes will be killed.
Besides that, you are limited to the amount of RAM that you requested.

Latest revision as of 12:41, 23 May 2025

  • Submit a slurm job, or start an interactive job on a node.
sinteractive

or for a Nvidia A100 GPU:

sinteractive -p gpu --gres=gpu:1 --constraint='nvidia&A100'
  • Check on which node this job has landed
squeue -u $USER -l
  • Add this to your machines ssh config in ~/.ssh/config
Host node* gpu*
    Hostname       %h.internal.anunna.wur.nl
    ProxyJump      login.anunna.wur.nl
    User           your_user_id

Host *.anunna.wur.nl
    User           your_user_id 
  • You can now use your local terminal connecting to e.g. node201 directly, by:
ssh node201
  • In VSCode :
in the VSCode GUI -> Open a remote Window -> Connect to Host...,type in the nodename. After a few seconds, VSCode is connected to the node.

Please be aware that once the slurm job finishes, the connection will be lost and your running processes will be killed. Besides that, you are limited to the amount of RAM that you requested.