From XastirWiki
Jump to: navigation, search

Setting up AX.25 Kernel Networking on Linux

What does an AX.25 kernel networking port buy you? More flexibility: You can attach multiple programs to a single port if you wish, for instance Digi_NED and Xastir can be connected at the same time, while you're doing TCP/IP connections out the port and someone else is connecting in to a converse node or a shell via connected-mode AX.25.

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 the system standpoint there's little difference between a wireless port, and ethernet port, and an AX.25 kernel networking port.

Checking the Linux Kernel Configuration

Check that your Linux kernel has AX.25 configured in:

  • Method 1: "grep ax25 /proc/kallsyms"

You should see "trans_net_ax25_table" and "trans_net_ax25_param_table"

  • Method 2: "zgrep -i ax25 /proc/config.gz"

You should see "CONFIG_AX25=m" and perhaps "CONFIG_AX25_DAMA_SLAVE=y". The "m" in the first instance tells us that the kernel has been built to use AX.25 protocol from kernel modules.

If your kernel does not have AX.25 support compiled in, you'll have to compile a special kernel for your system. See your OS-specific documentation for instructions plus the AX.25 HOWTO document listed in the links below.

Installing AX.25 Packages

You'll need some packages installed which match your kernel version. For OpenSuSE-11.1 Linux I installed these packages:

  • ax25-apps
  • ax25-doc
  • ax25-tools
  • libax25
  • libax25-devel (optional, needed if compiling applications that use AX.25)
  • soundmodem (if you want to use the soundcard as a TNC)

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.

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 a working axports file where I've defined two ports, "aprs" and "opentrac". Assign a different Callsign-SSID to each port defined:

# /etc/ax25/axports
#
# The format of this file is:
# name    callsign  speed paclen window description
#
aprs       KA7BCD    4800  256    7      144.39 APRS (1200 bps)
#opentrac  KA7BCD-1  4800  256    2      OpenTrac Testing Interface

"aprs" is just a text string we used for our port name. 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.

Modprobe.conf

Check /etc/modprobe.conf.local (included from modprobe.conf). Add the following if not already present. For Debian-based systems only: These get added into /etc/modules/aliases instead, then run /sbin/update-modules.

alias net-pf-3     ax25
alias net-pf-6     netrom
alias net-pf-11    rose
alias tty-ldisc-1  slip
alias tty-ldisc-3  ppp
alias tty-ldisc-5  mkiss
alias bc0          baycom
alias nr0          netrom
alias pi0a         pi2
alias pt0a         pt
alias scc0         optoscc    (or one of the other scc drivers)
alias sm0          soundmodem
alias tunl0        newtunnel
alias char-major-4 serial
alias char-major-5 serial
alias char-major-6 lp

Testing Manually

Change "ttyUSB0" or "ttyS1" below to match the name of the serial port you're using.

The IP number 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 we do 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:

> su   # (become root)
> /usr/sbin/kissattach /dev/ttyUSB0 aprs 44.24.250.250
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)

For the "call" command above:

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

If no errors are seen with the above commands, run this command as root to see if packets are being received:

  • /usr/bin/axlisten -c -a

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". It should look about like this:

#!/bin/sh
/usr/sbin/kissattach /dev/ttyUSB0 aprs 44.24.250.250
#                    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)
> 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/Shutdown Scripts

Create an "/etc/init.d/ax25" script. Create appropriate links in the rc3.d and rc5.d directories for starting/stopping the ports. See other scripts in the init.d directory for examples, particularly the "soundmodem" script if present.

Once you have a good script that can stop/start/restart the AX.25 ports, "/sbin/chkconfig" can install the links for the various runlevels (OpenSuSE Linux). There may be similar commands on other Linux variants. Assuming you named your script "ax25" and wish the port to be active for runlevels 3 and 5:

  • /sbin/chkconfig ax25 35

On Ubuntu (and possibly other Debian-based systems) "chkconfig" does not exist. The command that is related is "update-rc.d" --- see its man page for details of how to use it.

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)
  • chmod 4755 /usr/local/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"

Packet Radio Protocols

TBD ROSE, NET/ROM, TCP/IP, UDP/IP, Connected AX.25, Unconnected AX.25, APRS, OpenTrac, etc.

AX.25 Network Device Drivers

TBD

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.

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