In this article we’ll see how to run AX25 as a Systemd service, bringing the AX25 interface up on every boot and also putting the TNC into kiss mode. Having an AX25 interface allows you to share it among different applications like an APRS Digipeater or Winlink.
To setup an AX25 interface under linux the following is required: proper AX25 configuration, TNC attached to computer, Put the TNC into KISS mode, Run kissattach in the background.
In the past I had done this using commands started from /etc/rc.local not only is this ugly but it is not failure safe. I eventually came up with a more modern systemd based solution.
What follows has been tested on a Raspberry Pi under Raspbian 9.9 Stretch and on a PC running Debian 10 Buster.
First make sure you have git installed:
sudo apt install git
Clone the code to your machine, in your home directory.
cd ~ git clone https://github.com/F4FXL/ax25systemd.gitCode language: Shell Session (shell)
Change to the freshly cloned directory and run the makefile that will perform all the installation task.
cd ax25systemd sudo make install
We need to tell the AX25 utilities some things about the future interface. We so this by editing the file /etc/ax25/axports. I use tabs between each fields. The speed value is NOT the on-air speed! It is actually the speed used on the serial port to talk to the TNC.
This is how my axports file looks like:
# /etc/ax25/axports # # The format of this file is: # # name callsign speed paclen window description # APRS F4FXL-3 9600 255 7 144.800 MHz (APRS 1200 bps)Code language: Bash (bash)
Next step is to tell the system which ax port we want to bring up and how to put the TNC into KISS mode. The Linux AX25 layer is expecting the TNC to be in KISS mode before attaching to it.
This is done by editing the file /etc/default/ax25
Some explanation about the values you need to edit:
- AXPORT needs to match the name you cconfigured into /etc/ax25/axports
- HBAUD is the serial port speed for the computer to talk to the TNC, NOT the on-air speed.
- IPADDR is the AX25 interface interface. Leave ampty if none is required
- DEV the serial device, if you use an USB to Serial adapter it’ll probably be /dev/ttyUSB0
At the bottom of the file there are two commented out lines, one is for Nordlink T7F based TNC and the other for the Alinco EJ50u. Those lines call configuration scripts to put the TNC into KISS mode.
The EJ50u is very similar to the TNC found in the Kenwood radios therefore we can use its initilisation script for the Kenwood radios also. I successfully tested it with my TM-D710.
This is how the file looks like on my system.
# Configuration for AX.25 systemd unit file # The axport from /etc/ax25/axports to bring up. AXPORT=APRS # The AX.25 baudrate the TNC is configured for. # Make sure this matches the HBAUD setting of your TNC. # This is NOT the on-air baudrate, this is the serial baud-rate i.e. between computer and TNC HBAUD=9600 # IP Address and netmask, in CIDR notation e.g. 192.168.123.45/24 for 192.168.123.45 with netmask 255.255.255.0. # Leave empty if you do not need the AX interface to have an ip IPADDR= # The TNC serial path. DEV=/dev/ttyUSB0 # Initializing the TNC into KISS mode. Uncomment the line matching your TNC # # Line below is for TNC2 running Nordlink T7F ROM #TNC_INIT_CMD="/bin/stty -raw -parenb cs8 $HBAUD < $DEV && /usr/share/kissinit/nordlink_1k2 > $DEV && /bin/sleep 1" # # Line below is for Alinco ej50u TNC, also works for TMD710, THD7x etc #TNC_INIT_CMD="/bin/stty -raw -parenb cs8 $HBAUD < $DEV && /usr/share/kissinit/ej50u > $DEV && /bin/sleep 1"Code language: PHP (php)
Now you need to restart the ax25 service.
sudo service ax25 restartCode language: Shell Session (shell)
Check if the network interface comes up
sudo ifconfig ax0Code language: Shell Session (shell)
Should output something similar to this
ax0: flags=67<UP,BROADCAST,RUNNING> mtu 256 ax25 F4FXL-3 txqueuelen 10 (AMPR AX.25) RX packets 5 bytes 599 (599.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 0Code language: Shell Session (shell)
To conclude their are a few limitations. The on-air speed is hardcoded to 1200bps, this could be easily adjusted by changing the KISS initialisation scripts. Only one interface can be handled for now, this could also be changed as systemd allows such constructs.
There is no IP cconfigured on the interface As of 2019-07-07, it is possible to specify an IP address. Since I did not need such feature for the time being I have made the deliberate choice to not over engineer the whole thing.