Operating Packet Radio on Debian
To experiment with packet radio there are some basic things I need to be able to do. I need to monitor all packets, including those not addressed to me. I need to send individual packets, including a particular digipeater path if I choose. I need to make proper AX.25 connections to connect to BBSes. Ideally I want people to be able to make connections to my node too, and act as a digipeater for others to use.
The old hardware TNCs have all this functionality built in and you control it by connecting to its serial port and typing a series of specialised commands in the terminal. When I attach a KISS TNC to Debian, either in hardware or using a software modem, it’s totally not obvious how to use the AX.25 functionality in Linux to do these same basic tasks.
This post is a short overview of the tools built into Debian/Raspbian that I use to do the same things that you can do with a traditional TNC.
The Setup
The required packages on Debian are ax25-apps and ax25-tools.
To use the Debian AX.25 software the modem must be connected as a real network interface. In other words if you run /sbin/ifconfig
you should see an interface called ax0
:
ax0 Link encap:AMPR AX.25 HWaddr VK7NTK-1
UP BROADCAST RUNNING MTU:236 Metric:1
Broadly speaking the port and callsign need to be defined in /etc/ax25/axports
, the TNC needs to be running/connected, and finally kissattach binds it to an interface. The Dire Wolf soundmodem documentation and TNC-Pi documentation both have very clear instructions about how to do this configuration. The details will vary for different hardware.
Monitoring packets
sudo axlisten -t -a -c
This is my favourite set of parameters which enable timestamps, include outgoing packets in the output, and enable the use of ANSI colours in the output. See the man page for more detail.
It stays running and as packets are sent and received it presents neat output like the following until it is interrupted with ctrl-c.
Sending individual packets and beacons
Individual UI or “unproto” packets are useful for testing, APRS, having conversations via the ISS and so on. There is a terminal program that sends these and it’s called beacon.
sudo beacon -s -d <DEST> <PORT> "Message goes here"
To include a digipeater path use a space-separated -d parameter.
sudo beacon -s -d "CQ ARISS" 1 ">QE37PD/- 73 de Tom via ISS"
In this example CQ is the destination, ARISS is the callsign of the digipeater I want to use, and “1” is the name of my radio port, i.e. the first column in my axports file. This could easily be wrapped inside a shell script to avoiding needing to type so much every time.
The main purpose of beacon is to transmit a message periodically. If you don’t use -s it will go into the background and keep sending messages every 30 minutes, which is another useful function of some TNCs. See the man page for more info.
Connecting to nodes
sudo axcall <PORT> <DEST> [DIGIPEATERS...]
sudo axcall 1 VK7HDM-9
axcall
is an interactive terminal for connecting to a remote node. The top part of the screen shows text coming back from the remote station and the four lines down the bottom are a buffer where you type.
To terminate a connection cleanly from the local end, press ctrl-] to activate the menus then the down arrow twice to select the “Exit” option, then press enter. There are also menu options for sending data files which I haven’t experimented with much.
Note that traditionally AX.25 terminals indicate the end of the line with a single carriage return and this is what axcall uses. This is different from both Windows (CRLF) and Unix (LF) but is the same as pre-OSX Macs.
Receiving packets
I have more experimenting to do here but here’s an easy way to hook up a program to receive incoming connections using ax25d, an AX.25 equivalent of inetd.
Delete or rename /etc/ax25/ax25d.conf
to get rid of all the example junk and replace it with something like this:
[VK7NTK-1 via 1]
default * * * * * * * root /usr/games/fortune fortune
The ax25d configuration format is complex but this is enough to make it work. Note that the callsign including SSID and the port name from axports are both included in the square brackets.
The path to the program must be followed by all its arguments. If you are familiar with systems programming you will recall that the first argument to a program is always its own name.
Then run sudo ax25d
, which will disappear into the background if everything is fine. Now whenever a station connects they will receive a fortune then have the connection promptly terminated.
Showing connection state
netstat --protocol=ax25
This shows the stations that you are currently connected to and whether there is a program listening for ax25 connections.
Example output:
Active AX.25 sockets
Dest Source Device State Vr/Vs Send-Q Recv-Q
VK7HDM-4 VK7NTK-1 ax0 ESTABLISHED 001/000 0 0
VK7HDM-9 VK7NTK-1 ax0 ESTABLISHED 001/000 0 0
* VK7NTK-1 ax0 LISTENING 000/000 0 0
1 Comment
VA3ZUK
29 Feb 2020
Thank you for this blog post, this is the most straight forward resource for getting started with AX25 + BBS on Linux.