Changes between Initial Version and Version 1 of User Guide/Remote Access/Ssh Tunnel


Ignore:
Timestamp:
Oct 18, 2019, 8:19:13 PM (5 years ago)
Author:
jkol
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • User Guide/Remote Access/Ssh Tunnel

    v1 v1  
     1== Configuring SSH Tunnels ==
     2
     3A common need is to connect to some resource on the testbed as if it were local. SSH provides this functionality.
     4
     5=== Select the OS of your computer ===
     6
     7[[CollapsibleStart(Linux & MacOS)]]
     8''NOTE: These instructions are NOT for Ubuntu running on Windows using Windows Subsystem for Linux (WSL).''
     9
     10On Linux or Mac, via the terminal, make or edit a file at
     11{{{ ~/.ssh/config }}} by default.
     12
     13Make an entry like the following, replacing the specifics as needed
     14
     15{{{
     16Host console.sb1.cosmos-lab.org
     17  LocalForward 9001 srv1-lg1.sb1.cosmos-lab.org:80
     18}}}
     19
     20Now, when you ssh to console.sb1.cosmos-lab.org, traffic that you send to localhost port 9001, will be proxied and sent to srv1-lg1.sb1.cosmos-lab.org port 80. We commonly use this to access webUIs and similar things running on a node.
     21
     22Most SSH clients for other platforms have similar functionality. The important thing is to remember that the left side is your local port, and the right side is something that $HOST can talk to.
     23
     24To forward an additional port, or the same port on another device, add more lines.
     25{{{
     26LocalForward 9002 srv1-lg1.sb1.cosmos-lab.org:443
     27LocalForward 9003 srv1-lg1.sb1.cosmos-lab.org:80
     28LocalForward 9004 srv3-lg1.sb1.cosmos-lab.org:9090
     29}}}
     30
     31Just ensure that the ports on the left don't conflict.
     32
     33[[CollapsibleEnd]]
     34
     35[[BR]]
     36
     37[[CollapsibleStart(Windows)]]
     38These instructions assume that you are using [https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html PuTTY] as your SSH client and have configured your SSH session according to the [wiki:tutorials/ssh SSH Tutorial] instructions.
     39
     40==== Configuring PuTTY SSH Tunneling ====
     41
     42 1. Configure your session login information (or load it from a saved config) first.
     43
     44 2. Navigate through the left side menu tree to "Connection" → "SSH" → "Auth".
     45
     46 || [[Image(putty_tunnel_01.png, 250px)]] ||
     47
     48 3. Enter the local port you want to forward in the "Source port" field and the remote resource name (or IP address) along with the remote port in the "Destination" field (Note the colon ':' between the two). Avoid using a local port that may conflict with locally running services. In this example, the local port 50000 is forwarded to port 22 on node1-1.
     49
     50 || [[Image(putty_tunnel_02.png, 250px)]] ||
     51
     52 4. Click "Add" to add the tunnel to the session.
     53
     54 || [[Image(putty_tunnel_03.png, 250px)]] ||
     55
     56 || [[Image(putty_tunnel_04.png, 250px)]] ||
     57
     58 5. Repeat steps 2-3 for as many ports as you need to forward. Remember that each local port you use can only map to a single remote resource/port destination.
     59
     60 6. If you click "Open", your session will start with the configured ports tunneled, but when you close the session you will have to configure the ports again. If you go back to the "Session" screen and save the settings, the port tunneling configuration will be saved for future use.
     61
     62[[CollapsibleEnd]]