From XastirWiki
Jump to: navigation, search

Setting up AX.25 Kernel Networking on Ubuntu or Debian Linux

What does an AX.25 kernel networking port buy you? More flexibility: Multiple programs can share a single port - i.e. share a single TNC/Radio setup. For example, Xastir and a small daemon like aprx could be running on the same computer and connected to the same TNC at the same time.

The downside: It's requires a bit more setup than some other methods, plus some daemons and games may attempt to use the port as a standard networking port. From a system standpoint there's little difference between a wireless port, and ethernet port, and an AX.25 kernel networking port.

Serial Port

It's best to make sure the serial port you plan to use for AX25 networking already works. Better yet, get it working with a TNC in KISS mode so that when it's time to convert to AX.25, the serial port, TNC, and radio are ready to go. Note that I'm assuming that the intent is to use AX.25 networking to connect to a TNC in KISS mode as opposed to a sound card via soundmodem, which is outside the scope of this HowTo.

For "soundmodem" configuration please skip to the HowTo:SoundModem page instead. It's possible to set up soundmodem as a Serial KISS TNC or an AX.25 kernel networking port, both described on that Wiki page.

Installing AX.25 Packages

You'll need some packages installed which match your kernel version. In Ubuntu 11.04, Linux Mint Debian, and Mepis 11 (based on Debian 6/Squeeze), I installed the following:

  • ax25-apps
  • ax25-tools
  • libax25 (if you already have installed or compiled XASTIR, libax25 should already be installed)
  • libax25-dev (optional, needed if compiling applications that use AX.25 - including XASTIR if you built it from source!)

Configuring AX.25 Ports

Take a look at /etc/ax25/ directory. You should see some example config files there. For our purposes this is the important one:

  • axports - AX.25 port configuration file

Here's an example of what started as the default axports file where I modified it first by commenting out the two lines beginning with "1" and "2", then adding the line beginning with "aprs". Please use your own callsign and applicable SSID on your file!

 
# /etc/ax25/axports
#
# The format of this file is:
#
# name callsign speed paclen window description
#
#1	OH2BNS-1	1200	255	2	144.675 MHz (1200  bps)
#2	OH2BNS-9	38400	255	7	TNOS/Linux  (38400 bps)
aprs	K5DAT-10	9600	256	7	144.39 APRS (1200 bps)

"aprs" is just a text string that is used to name the port. Call it something else if you choose, but it must match up with the commands we'll show later in the page, so remember to change them too.

The generic HowTo for AX25 had a modprobe section, but the results of the queries there didn't quite jibe for Ubuntu/Debian, so I jumped right into the testing.

Testing Manually

Note: Change "ttyS0" or "ttyS1" below to match the name of the serial port you're using. A usb to serial adapter is most commonly "ttyUSB0", but your mileage may vary.

The IP address in the examples below is needed only for TCP/IP operation. It's normally assigned by your local or regional TCP/IP ham coordinator. It is often acceptable to use a temporary number like what is shown below for a short time until you get assigned a number, or just as a placeholder in the scripts if you're not going to do TCP/IP over AX.25 protocol.

In Ubuntu 11.04, this is all I needed:

> sudo /usr/sbin/kissattach /dev/ttyS0 aprs 44.24.250.249
AX.25 port aprs bound to device ax0
> #                          port     txd     slottime  persistence tail    half-duplex
> sudo /usr/sbin/kissparms  -p aprs  -t 500  -s 200    -r 32       -l 100  -f n
> sudo /sbin/route add -net 44.0.0.0 netmask 255.0.0.0 dev ax0
> sudo /bin/ping -i 10 44.136.8.58   # (ping packets go out on RF each 10 secs, control-C to stop)
> sudo /usr/bin/axcall aprs k7xyz via sea   # (Connect packets go out on RF)
> sudo /usr/bin/axlisten -c -a  # (listens for packets and displays then in the term window, Control-C to stop)

In Linux Mint Debian (LMDE), I also issued "sudo modprobe ax25" and "sudo modprobe mkiss" prior to issuing the commands above, and my serial port on that box was actually "USB0" (but, of course, use what yours is). The modprobe commands were issued while troubleshooting a misbehaving usb to serial adapter, and they may not have been needed. It does no harm to issue them - it makes sure those modules are loaded into the kernel.

In Mepis 11, which is based on Debian v6/Squeeze, I did the following (should also apply to Debian 6):

Note: the 2 modprobe commands may not be needed - I ended up issuing them during the course of troubleshooting an issue that turned out to be a problem with some kind of invisible corruption or garbage characters in the axports file. It does no harm to issue them, however.

> su   # (become root)
> modprobe ax25
> modprobe mkiss
> /usr/sbin/kissattach /dev/ttyS0 aprs 44.24.250.249
AX.25 port aprs bound to device ax0
> #                    port     txd     slottime  persistence tail    half-duplex
> /usr/sbin/kissparms  -p aprs  -t 500  -s 200    -r 32       -l 100  -f n
> /sbin/route add -net 44.0.0.0 netmask 255.0.0.0 dev ax0
> /bin/ping -i 10 44.136.8.58   # (ping packets go out on RF each 10 secs, control-C to stop)
> /usr/bin/axcall aprs k7xyz via sea   # (Connect packets go out on RF)
> /usr/bin/axlisten -c -a  # (listens for packets and displays then in the term window, Control-C to stop)

For the "call" command above:

  • ~? will list the escape commands
  • ~. will close the connection

See "man 4 ax25" or "man call" for more info on the "call" command above. "man axlisten" for the "axlisten" command instructions.

To stop the port entirely (remove it from operation), do the following:

  • /usr/bin/killall kissattach

Manual Startup/Shutdown Scripts

Put the commands above (kissattach/kissparms/route) in a script called "ax25.up".

The scripts should look something like this for Ubuntu 11.04 and Linux Mint Debian:

#!/bin/sh
sudo modprobe ax25   # was not needed when testing Ubuntu 11.04
sudo modprobe mkiss  # was not needed when testing Ubuntu 11.04
sudo /usr/sbin/kissattach /dev/ttyS0 aprs 44.24.250.249
#                    port     txd     slottime  persistence tail    half-duplex
sudo /usr/sbin/kissparms  -p aprs  -t 500  -s 200    -r 32       -l 100  -f n
sudo /sbin/route add -net 44.0.0.0 netmask 255.0.0.0 dev ax0

Create another script called "ax25.down" containing:

#!/bin/sh
sudo /usr/bin/killall kissattach

The scripts should look something like this for Debian 6 or Mepis 11:

#!/bin/sh
modprobe ax25   # may not be needed
modprobe mkiss  # may not be needed
/usr/sbin/kissattach /dev/ttyS0 aprs 44.24.250.249
#                    port     txd     slottime  persistence tail    half-duplex
/usr/sbin/kissparms  -p aprs  -t 500  -s 200    -r 32       -l 100  -f n
/sbin/route add -net 44.0.0.0 netmask 255.0.0.0 dev ax0

Create another script called "ax25.down" containing:

#!/bin/sh
/usr/bin/killall kissattach

Type these commands to set up ownership and permissions:

> su   # (become root) (or for Ubuntu and LMDE use "sudo -s")
> chown root ax25.up ax25.down
> chmod 4755 ax25.up ax25.down
> exit   # (leave root)

To bring up the port(s):

  • ./ax25.up

To take them down again:

  • ./ax25.down

Automating the Startup Script

Debian and Ubuntu both support what the Ubuntu docs refer to as "traditional sysvinit scripts", which is one method of setting up the AX25 interface automatically at boot.

First create a script like the one below, and copy/move it to /etc/init.d (This one is named ax25go - if you use a different name, notice you'll have to change 2 lines in the script to match.) The script below sets up ttyS0 as the AX.25 interface - use the serial port that matches your hardware.

#! /bin/sh

### BEGIN INIT INFO
# Provides:          ax25go
# Required-Start:
# Required-Stop:
# Should-Start:      $local_fs
# Should-Stop:       $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: configure AX25 Port
# Description:       commands to set up one serial port as an AX25 interface
### END INIT INFO

NAME=ax25go

/sbin/modprobe ax25
/sbin/modprobe mkiss
/usr/sbin/kissattach /dev/ttyS0 aprs 44.24.250.249
/usr/sbin/kissparms -p aprs -t 500 -s 200 -r 32 -l 100 -f n
/sbin/route add -net 44.0.0.0 netmask 255.0.0.0 dev ax0

exit 0

Next get into root mode either via "su" or "sudo -s" at a command prompt depending on your OS.

At the root prompt, issue the following command:

 update-rc.d ax25go defaults 18 

(the command response is "update-rc.d: using dependency based boot sequencing")

I chose 18 in the command above because I wanted the ax25 initialization script to run before my aprx daemon, which runs at 19

Setting Up Xastir to Use the Port

For Xastir to use kernel AX.25 ports, Xastir itself has to be set "SUID root". This means that Xastir can become the root user when it needs to open a port, but it has been written to drop privileges when it doesn't need them:

  • su # (become root) - (for Ubuntu or LMDE, use "sudo -s")
  • chmod 4755 /usr/local/bin/xastir # if you are running a binary Xastir, use "chmod 4755 /usr/bin/xastir"
  • exit (from root)
  • Restart Xastir

In Xastir itself:

  • Interface->Interface Control
  • Add -> AX25 TNC
  • Enter the name you gave the port above in the /etc/ax25/axports file ("aprs")
  • Press "OK"

Extra transmissions seen after configuring port

Extra transmissions could be from any network-capable program such as "Samba", "Icecream", or other Linux daemons or games. Many periodically send broadcasts on all networking ports.

Samba has been known to do this: Tweak the Samba config file to specify which ports it can/cannot use. Samba will re-read it's config file within 60 seconds and stop using the port. You can also uninstall samba via synaptic or apt-get if you don't use it.

Icecream has done this on wireless ports, so I assume it might do the same for an AX.25 port. Either kill it or change it's configs to disallow that port.

CUPS is also responsible for this sort of behavior if you enable the "Share published printers connected to this system" option. This option defaults to "off" but if you turn it on, CUPS rudely broadcasts IPP discovery packets repeatedly to all interfaces, and gives absolutely no option for selecting which interfaces to use. There are bugs in the CUPS bugzilla about this.

Dropbox, an offsite backup/archive service will pump broadcast messages to all interfaces by default also. The key is the "port": 17500, appearing in the output of a '/usr/bin/axlisten -c -a' command. To avoid this problem, right click on the dropbox icon in the system tray (at least in KDE it's there), select Preferences and deselect the 'Enable LAN Sync' check box.

Alternatively one can tweak the firewall rules to disallow those daemons from talking out specific ports.

AX.25 Links

Soundmodem Links