| 250 | |
| 251 | === SSH Tunneling === |
| 252 | |
| 253 | A common need is to connect to some resource on the testbed, as if it were local. SSH provides this functionality. |
| 254 | |
| 255 | The simplest variant is via an openssh config file. |
| 256 | On Linux or Mac, via the terminal, make or edit a file at |
| 257 | {{{ ~/.ssh/config }}} by default. |
| 258 | |
| 259 | Make an entry like the following, replacing the specifics as needed |
| 260 | |
| 261 | {{{ |
| 262 | Host console.sb1.cosmos-lab.org |
| 263 | LocalForward 9001 srv1-lg1.sb1.cosmos-lab.org:80 |
| 264 | }}} |
| 265 | |
| 266 | Now, 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. |
| 267 | |
| 268 | Most 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. |
| 269 | |
| 270 | To forward an additional port, or the same port on another device, add more lines. |
| 271 | {{{ |
| 272 | LocalForward 9002 srv1-lg1.sb1.cosmos-lab.org:443 |
| 273 | LocalForward 9003 srv1-lg1.sb1.cosmos-lab.org:80 |
| 274 | LocalForward 9004 srv3-lg1.sb1.cosmos-lab.org:9090 |
| 275 | }}} |
| 276 | |
| 277 | Just ensure that the ports on the left don't conflict. |
| 278 | |
| 279 | |
| 280 | |
| 281 | |