Introduction

The socat mechanism described in my AX25 over IP post can also be used to connect other AX.25 systems that use KISS together. A practical use of this is to connect a LinBPQ instance to the Linux AX.25 stack on the system that it's running on. This can be helpful to share a TNC between the two systems, and to allow systems to reach NET/ROM systems via the other system.

socat

The first thing we need to do is set up the systemd service to manage socat.

I'm assuming BPQ will be running as the linbpq user as is the case for the packaged version of LimBPQ distributed by OARC. You may need to adjust the ownership of the /var/ax25/pty/bpq directory if this is not the case on your system.

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

# /etc/systemd/system/kiss-socat-local.service
[Unit]
Description=Socat interconnect for BPQ
After=network-online.target
Wants=network-online.target

[Service]
WorkingDirectory=/var/ax25
ExecStart=socat -d -d -ly pty,raw,echo=0,link=/var/ax25/pty/bpq/bpq1 pty,raw,echo=0,link=/var/ax25/pty/bpq/bpq2
ExecStartPost=/usr/bin/bash -c 'while ! [ -h /var/ax25/pty/bpq/bpq2 ]; do sleep 1 ; done'
ExecStopPost=rm /var/ax25/pty/bpq/bpq1 /var/ax25/pty/bpq/bpq2
User=linbpq

[Install]
WantedBy=multi-user.target

Create the /var/ax25/pty/bpq directory, then enable and start the service:

$ sudo mkdir -p /var/ax25/pty/bpq

$ sudo chown linbpq /var/ax25/pty/bpq

$ sudo systemctl daemon-reload

$ sudo systemctl enable kiss-socat-local

$ sudo systemctl start kiss-socat-local

axports

we need an entry in /etc/ax25/axports - use your callign and a suitable SSID:


local N0CALL-12 115200 255 7 Local connection to LinBPQ

kissattach

The kissattach program is used to set up communication between Linux's AX.25 stack and LinBPQ, via the socat process.

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 AXIP tunnel, first enable it:

$ sudo systemctl enable kiss-tnc@local

Then edit it:

$ sudo systemctl edit kiss-tnc@local

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


[Unit]
After=kiss-socat-local.service
[Service]
Environment=TNC_TTY=/var/ax25/pty/bpq/bpq2
Restart=on-failure
RestartSec=5s

And then start the service:

$ sudo systemctl start kiss-tnc@local

LinBPQ

To configure the LinBPQ side of the connection, add the following to your bpq32.cfg file. Adjust the port number to fit with the numbering scheme you are using.


PORT
 PORTNUM=2
 ID=local
 PROTOCOL=KISS
 COMPORT=/var/ax25/pty/bpq/bpq1
 SPEED=115200
 QUALITY=0
 MINQUAL=128
 MAXFRAME=2
 FRACK=4000
 RESPTIME=1000
 RETRIES=10
 PACLEN=236
ENDPORT

The restart LinBPQ:

$ sudo systemctl restart linbpq

After a few moments you should find you can connect to your LinBPQ instance from Linux with axcall local and the callsign BPQ is using.

By increasing the QUALITY setting and configuring netromd on the Linux side, NET/ROM routing information can be exchanged between the two systems.