Bind ax25 interface to Direwolf

It can be easy to link an ax25 interface to Direwolf. This makes it possible to use RMSGateway, Uronode etc with Direwolf.
In this script Direwolf is started with the -p option. With the -p option a virtual tnc is created. /tmp/kisstnc.

With mkiss a kiss connection is made on the /tmp/kisstnc. With kissattach the PTY is connected to the ax25 interface.

Fist edit the file axports in /etc/ax25

pd9q@pd9q:/etc/ax25 $ cat axports
# /etc/ax25/axports
# name callsign speed paclen window description
#
ax0     PI1LAP-9       19200    255     7     RMSGateway pi1lap-10

Config the direwolf.conf file to set the right audio device and ptt port. Save file to /etc/ax25/direwolf.conf

ADEVICE plughw:1,0
ACHANNELS 1
CHANNEL 0
MODEM 300 2130:2230 D
PTT GPIO 21
DWAIT 0
SLOTTIME 12
PERSIST 63
TXDELAY 40
TXTAIL 10
FIX_BITS 1 AX25
LOGDIR /var/log/direwolf

Run the script

#!/bin/bash
   PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/etc/ax25:/usr/local/ax25
   echo "Starting direwolf"
     direwolf -t 0 -c /etc/ax25/direwolf.conf -p &
   #Check if Direwolf is running
   sleep 5
   if [ -z "`ps ax | grep -v grep | grep direwolf`" ]; then
      echo -e "\nERROR: Direwolf did not start properly and is not running, please review direwolf.conf"
         exit 1
   fi
   echo "Installing one KISS connection on PTY port /tmp/kisstnc"
     mkiss -s 19200 -x 1 /tmp/kisstnc > /tmp/unix98
   #This creates a PTS interface like "/dev/pts/3"
     export PTS0=`more /tmp/unix98 | grep -w /dev | cut -b -11`
     echo "PTS0 device: $PTS0"
     kissattach $PTS0 ax0  > /tmp/ax25-config.tmp
     awk '/device/ { print $7 }' /tmp/ax25-config.tmp > /tmp/ax25-config1-tmp
     read Device < /tmp/ax25-config1-tmp

Let’s check if everything went well.

pd9q@pd9q:~ $ ps ax
1015 ?        Ss     0:00 mkiss -s 19200 -x 1 /tmp/kisstnc
1025 ?        Ss     0:00 kissattach /dev/pts/2 ax0

Try it out…

pd9q@pd9q:~ $ call ax0 pd9q-2
GW4PTS AX.25 Connect 2.0.0
Trying...
*** Connected to pd9q-2
*** Cleared

Now it’s possible to setup RMSGateway or Uronode of whatever you want.