BBB Reverse SSH Tunnelling

From Klaus' wiki
Jump to: navigation, search

So you want to use bren for development but the BBB is situated just next to you. No problem!

You'll just have to setup a reverse SSH tunnel!

According to this page it is easy to setup a reverse SSH tunnel.

First on the BBB open a ssh connection to bren

]$ ssh -R 19213:localhost:22 klausk@bren.hih.au.dk

where you will change the port number 19213 to another unused and klausk to your login name. Find a free port by using this command:

]$ netstat -ln | grep <yourDesiredPortNumber>

if not in use you will get no response. If in use you may get a response like this

]$  netstat -ln|grep 19213
tcp        0      0 127.0.0.1:19213         0.0.0.0:*               LISTEN  

Next thing to do is to log in when the connection is established from BBB to bren. NOTE: you can see over on the Linux hints page how to exchange ssh keys to obtain a passwordless login.

While you keep this connection open you can from your laptop log into bren and try out if you got a whole through to your BBB

[klausk@bren ~]$ ssh klaus@localhost -p 19213
Debian GNU/Linux 7

BeagleBoard.org Debian Image 2015-03-01

Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian

default username:password is [debian:temppwd]

klaus@localhost's password: 
Last login: Sun May  3 19:12:59 2015 from 192.168.0.183
klaus@beaglebone:~$ 

If you get something similar you've got a whole through from bren to your BBB.

Reverse SSH

This picture describes what is going on.

  • The Blue arrow are the initial SSH connection from your BBB to bren - the one with the reversed property,
  • The red arrow shows a new ssh connection from your laptop to bren could be a x2go session and
  • Finally the green arrows shows the ssh connection (initiated from the red connection, e.g. by eclipse) from bren to your BBB through the reversed tunnel.

This configuration can, of course, also be used locally on the premisses of the University, just adjust the host addresses accordingly.

Final thing to do is to configure the Eclipse on bren to use this remote debugging interface. See BBB Remote Debugging page for details.