Home | Guides | Software | Hardware | Discussions | Shop | Contact Me | Donate


2018-07-01

IP over LoRa: Using RNode as a wireless NIC

This post was updated in August 2020 to reflect the now preferred method of using tncattach instead of the old ax-utils tools.

IP over LoRa? Absolutely!

While LoRa was not as such designed as an underlying physical layer for IP-based communications, it's still possible to do exactly that.

A very handy feature of RNode is that you can attach it to your computer, Rasbperry Pi, or similar, as a generic network interface. It's probably the easiest way to run IP, TCP, UDP and whatever you might fancy over LoRa. As such, you can run more or less any networked application over LoRa.

To do so, you will need to use the tncattach program I wrote for this purpose. First download and install the program, for this refer to the current installation instructions on the tncattach GitHub page.

When tncattach is installed, you must then use the RNode Config Utility to put your RNode into TNC mode. Here's an example command:

./rnodeconf /dev/ttyUSB0 -T --freq 867000000 --bw 250000 --txp 14 --sf 7 --cr 5

The above setup yields an on-air bitrate of 10.9 kbps, and will prepare the device to be used as a generic network adapter. Please make sure to configure a frequency, bandwidth and output power that is suitable for the jurisdiction you are in.

When the RNode has been put into TNC mode, you simply need to run the tncattach program with the options you need to bring up the networking interface. For a complete guide on how to use tncattach, please see this post on the subject.

Generally speaking, a command like the following will create a full ethernet-compatible networking interface with the connected RNode, bring it up and configure an IP address:

sudo tncattach /dev/ttyUSB0 115200 -d -e -n -m 478 -i 10.99.0.1/24

That's it! You now have a wireless Ethernet and IP interface using LoRa modulation up and running!

Notes on MTU

The MTU that is set with tncattach is the MTU for the kernel networking interface. That is, it is the MTU for the interface you see when you type for example ifconfig tnc0. The MTU value set here tells the kernel how many bytes of payload data can be squeezed into a single physical-layer packet.

This value should not be set to the direct physical layer MTU of the TNC device! For example, even though OpenModem supports an MTU of 576 bytes, and RNode supports an MTU of 500 bytes, you need to take into account the overhead of any link-layer protocol that is transported with tncattach.

In practical terms, this means that if you just want to use point-to-point IP links with tncattach, the overhead will be 4 bytes. For full ethernet, the overhead will usually be 18 bytes, but if you also need to support 802.11q VLAN tags, it will be 22 bytes. You need to subtract this overhead from the device MTU and pass that value to tncattach.

For OpenModem, correct MTU values to use with tncattach would be 572, 558 and 554 respectively, for point-to-point IP links, Ethernet and Ethernet with VLAN tags. For RNode, correct MTU values to use with tncattach would be 496, 482 and 478 respectively, for point-to-point IP links, Ethernet and Ethernet with VLAN tags.