Introduction

This post aims to explain how to set up a basic Linux NET/ROM node for participation in Amateur Packet Radio.

Lines starting with $ are commands to be typed.

I'll be using a Raspberry Pi 3 running the current Raspberry Pi OS at the time of writing (bullseye), and a NinoTNC USB KISS TNC. These instructions will likely work for Debian and other debian-dervied systems, and other KISS TNCs including soundmodem and direwolf, but they will require their own configuration be done first.

I've also written an ansible role to perform the same steps described here.

SSIDs and aliases

AX.25 identifies ports using Amateur Radio callsigns. As it is often necessary to have more than one port or station, Secondary Station Identifiers (SSIDs) are used. These take the form of CALLSIGN-NUMBER.

The number can be from 0 to 15. When 0 is used it is typically ommited when the SSID is displayed and just CALLSIGN is shown.

While SSIDs can be used for anything there are some conventions associating particular numbers with particular types of service.

In general, low numbers are reserved for services that users will interact with and high numbers used for things like backbone ports which will not normally be seen.

NET/ROM aliases are used to provide convenient names for services, and are frequently used to provide geographic names for nodes. They should be 6 characters or less.

Software packages

Starting with a fresh, updated Raspberry Pi OS. we need to install ax25-tools and ax25-apps.

$ sudo apt-get install ax25-tools ax25-apps

Kernel modules

AX.25 and NET/ROM is included in the Linux kernel packages. AX.25 will load automatically when we configure the TNC, but we need to ensure netrom is loaded.

Add netrom to /etc/modules. To load it right away, run:

$ modprobe netrom

TNC

Before we can use the TNC we need to define an AX.25 port for it, and run kissattach to enable it.

Add the following to /etc/ax25/axports, replacing N0CALL with the callsign being used:


tnc     N0CALL-15        57600 255      7       NinoTNC

This defines the ax.25 port 'tnc' with its callsign, serial port speed, packet size, window size, and finally a comment describing the port.

The kissattach program is used to set up communication between a Linux AX.25 interface and a KISS TNC.

In order to assure it runs automatically when the system boots, I'm going to use a systemd unit.

Create a file at /etc/systemd/system/kiss-tnc@.service containing the following:

# /etc/systemd/system/kiss-tnc@.service
[Unit]
Description=AX25 KISS TNC %I

[Service]
ExecStart=/usr/sbin/kissattach $TNC_TTY %i
ExecStop=pkill -f "kissattach $TNC_TTY %i"
ExecStartPost=/usr/bin/bash -c 'while ! /usr/sbin/kissparms -c 1 -p %i; do sleep 1; done'
TimeoutStopSec=5
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target

This is a template unit file that can be used for several TNCs or AXIP tunnels.

To configure an instance for our TNC, first enable it:

$ sudo systemctl enable kiss-tnc@tnc

Then edit it:

$ sudo systemctl edit kiss-tnc@axip

Add the following to the top of the file and then save it:


[Service]
Environment=TNC_TTY=/dev/ttyACM0

$ sudo systemctl start kiss-tnc@tnc

At this point, ip link show should list an AX.25 port - ax0 as well as four netrom ports - nr0 - nr3.

We can test that the interface and TNC are working with the 'beacon' command:

$ beacon -s tnc 'This is a test'

If everything is working this will key the radio and send a short message.

If you don't have a radio attached to the TNC you can also check the operation of the beacon command by running axlisten -cra in a second terminal window - this will monitor all AX.25 activity on the machine.

NET/ROM port

There are two configuration files for netrom - nrports and nrbroadcast.

Much like axports, nrports assosicates a netrom port name with a callsign, as well as aliases, link quality and a descriptive comment.

Add the folllowing to /etc/ax25/nrports, again substituting the callsign, and replacing NCALL with a suitable alias for this port.


netrom N0CALL-14 NCALL 236     Linux Switch Port

nrbroadcast defines a list of AX.25 ports that we're going to run NET/ROM over and that we will use to broadcast routing information.

It also defines parameters which affect descisions about what routes we will accept, and information for other stations about our routes.

I'm not going to describe these in detail just now. If you're joining a NET/ROM network your link partner should be able to advise on the best settings for this file.

Comment out the default lines in /etc/ax25/nrbroadcast with # characters and add the following:


tnc 5   203 129 1

As with the TNC, we also need to run a command - nrattach - to enable our NET/ROM interface, and again I'll be using a unit file to make sure this happens on boot.

Create /etc/systemd/system/nrattach@.service with the following:


[Unit]
Description=AX.25 NET/ROM interface %I
After=network.target
StartLimitInterval=0

[Service]
Type=oneshot
ExecStart=/usr/sbin/nrattach %i
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

This is a template unit so we can use it for more than one netrom port if needed. Specify the netrom port name after an @ when issuing systemctl commands.

$ sudo systemctl daemon-reload

$ sudo systemctl enable nrattach@netrom

$ sudo systmectl start nrattach@netrom

Note: nrattach can be unpredictable if run in parallel. If you're going to use this unit for mutiple NET/ROM ports it will be necessary to ensure the ports are brought up in sequence. This r/systemd post explains how to do this.

netromd

We need to run netromd which will manage the exchange of NET/ROM routing information with other nodes on the network.

It doesn't require any configuration, just another unit file:

Create /etc/systemd/system/netromd.service:


[Unit]
Description=NET/ROM routing daemon
After=network.target
StartLimitInterval=0

[Service]
Type=simple
Restart=always
RestartSec=5
ExecStart=/usr/sbin/netromd -i

[Install]
WantedBy=multi-user.target

$ sudo systemctl daemon-reload

$ sudo systemctl enable netromd

$ sudo systemctl start netromd

Retaining routing information

To preserve bandwith, NET/ROM nodes tend to broadcast their routing information slowly, typically with intervals between 15 and 60 minutes. Because of this it can take a while for a rebooted node to obtain a working routing table. To help with this, ax25-tools provides a nodesave command that can be used to save and reload the NET/ROM routing table when the system is rebooted.

The commands generated by nodesave will fail if the AX.25 interfaces aren't up, so it's necessary to include After= lines in the .service file to ensure nodesave.sh is run after relevant services have started.

Create /etc/systemd/system/nodesave.service:


[Unit]
Description=Persist NET/ROM routing information
After=network.target
After=kiss-tnc@tnc.service
StartLimitInterval=0

[Service]
Type=oneshot
ExecStart=bash -c '[ -x /etc/ax25/nodesave.sh ] && /etc/ax25/nodesave.sh; exit 0'
ExecStop=bash -c '/usr/sbin/nodesave > /etc/ax25/nodesave.sh && chmod 755 /etc/ax25/nodesave.sh'
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

$ sudo systemctl daemon-reload

$ sudo systemctl enable nodesave