... to communicate over SSH using LoRa
Quick Links
Hardware Setup
Some of the most affordable LoRa hardware is available from lilygo. For this project, I purchased two LilyGO T-Beam v1.1 devices that are supported by Reticulum.
Before trying to connect the devices, you'll need to flash the RNode firmware to each T-Beam separately. Plug one T-Beam at a time into your computer, identify it's location in the /dev/
folder. In my case, it was /dev/ttyACM0
. Follow these commands to flash the RNode firmware to your T-Beam.
# Install pip
$ sudo apt install python3-pip
# Install rnodeconf via rns package
$ pip install rns --upgrade
# Install the firmware on a board with the install guide
$ rnodeconf --autoinstall
Depending on your Linux distribution, you may run into errors while attempted to install 'rns'. This pip package requires that the pip package 'cryptography' also install properly. 'cryptography' may require it's own set of unique packages. If you face issues, try these in order.
#Install the newest version of rust
$ sudo apt install curl
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
#Verify rust
$ rustc --version
$ cargo --version
#Install OpenSSL Development Package
$ sudo apt install libssl-dev
If you are still unable to install 'rns', try installing 'cryptography' alone first. Also try some of these packages. Keep reading the error logs and try to identify the missing dependency. Don't forget to reboot after each new install and try to install 'rns' again. Once you install the right dependency, it should install properly.
$ sudo apt install build-essential
$ sudo apt install pkg-config
Setup Reticulum
Once 'rns' has installed and you have flashed the firmware to both T-Beams, it's time to setup your config files. You'll need to do these commands on both computers. Run the rns daemon once to create your config file in the ~/.reticulum
folder.
$ rnsd
This creates a baseline config file, but you'll have to add more to make it work. Here is the config file I used to make two Debian computers with T-Beam devices connect over SSH. I've removed all the '#' lines to make it easier on the eyes.
[reticulum]
enable_transport = False
share_instance = Yes
shared_instance_port = 37428
instance_control_port = 37429
panic_on_interface_error = No
loglevel = 4
[interfaces]
[[Default Interface]]
type = AutoInterface
enabled = Yes
[[RNode LoRa Interface]]
type = RNodeInterface
interface_enabled = True
port = /dev/ttyACM0
frequency = 915000000
bandwidth = 125000
txpower = 7
spreadingfactor = 8
codingrate = 5
flow_control = False
Setup TNCattach
#Install build tools
$ sudo apt install build-essential
#Install git
$ sudo apt install git
#Clone repository
git clone https://github.com/markqvist/tncattach.git
#Move into source directory
cd tncattach
#Make program
make
#Install to system
sudo make install
If you already flashed your T-Beam devices using rnodeconf above, you can put them into TNC mode by using the following command and entering the following options.
rnodeconf -T /dev/ttyACM0
915000000
125000
7
8
5
Creating a Point-To-Point Link
- https://unsigned.io/website/ethernet-and-ip-over-packet-radio-tncs/
- https://www.technopolis.tv/blog/2023/05/22/TNC-IP-over-LoRa/
With both Debian computers with the proper config file in the /.reticulum/
folder, and both with a T-Beam plugged in as showing up as /dev/ttyACM0
, you can try to connect them.
The main issue that came up during this part of the process was the lack of 'ifconfig'. 'ifconfig' has been deprecated and replaced with the 'ip' or 'ip-route' tool. I tried to use 'ip' to setup a point-to-point connection, but to no avail. Luckily, ifconfig is still available in the 'net-tools' package.
#Install ifconfig
$ sudo apt install net-tools
#Attach the interface
$ sudo tncattach /dev/ttyACM0 115200 -d --mtu 496 --noipv6 --noup
#Configure IP addresses for point-to-point link
$ sudo ifconfig tnc0 10.0.0.1 pointopoint 10.0.0.2
Now run the same commands on the second Debian computer, except invert the two IP addresses in the last command. This implies that they can only speak to each other 10.0.0.1 <--> 10.0.0.2.
#Test the connection
$ ping 10.0.0.2
#Connect using compressed SSH
$ ssh -C william@10.0.0.2
If you're having issues, try running ifconfig
. The following output would indicate that tncattach is working properly and you've created the tnc0 interface
tnc0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 400
inet 10.0.0.1 netmask 255.255.255.255 destination 10.93.0.2
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Conclusion
Thanks to Reticulum, RNode firmware, and https://unsigned.io/ it is relatively simple to connect two devices and communicate over SSH over long distances. TNCattach also has the ability to create a network over LoRa, as opposed to a point-to-point connection.