Winlink

ID #1016

How to run packet radio with debian gnu/linux or mac osx (Bob Brose)

Running packet radio with debian gnu/linux or mac osx


General instructions for Linux using the AX.25 kernel driver are directly below with specific instructions for using a standard serial TNC as well as specific instructions for using a userspace soundmodem driver or jump to linux using a userspace (xNos) program for AX.25.

Configuration common to both TNC and Soundmodem drivers
First, you need the a kernel compiled with the appropriate options.
The 2.2, 2.4 and 2.6 kernel version are all pretty similar in this area. The only notable exception is that if you are using your sound card to do packet, you do not want to run the soundmodem kernel driver, use the user space driver instead (see the soundmodem section below) My kernel has:

Amateur radio support turned on
AX25 level 2 support on as a module
NetRom Protocol turned on as a module

Under AX25 Drivers I have:

Kiss, 6Pack, BPQ and YAM turned on as modules. Most of you will probably only need the Kiss Driver.

Software I am using (install using apt-get for debian or whatever for other versions of linux):

libax25 0.0.11-4 ax25 library for hamradio applications

ax25-apps 0.0.6-14.1 AX25 ham radio applications

ax25-tools 0.0.8-11 AX-25 tools

Optional
ax25-xtools 0.0.8-11 AX-25 tools (X versions)

Optional
ax25spyd 0.23-7 AX.25 traffic analyzer, dumper and spy daemon

Required only if using a soundcard and not a TNC
soundmodem 0.10-1 Sound Card Amateur Packet Radio Modems

Optional
fbb 7.04j-6 Packet radio mailbox and utilities

Optional
fbbdoc 1999-1 Documentation for fbb, the packet radio mail


Common for all setups, you will need to alter some configuration files in the /etc/ax25 directory. Minimally you need:
/etc/ax25/axports

# /etc/ax25/axports
#
# The format of this file is:
#
# name callsign speed paclen window description
# Uncomment line below for a soundmodem.
# Change the call to yours. Speed isn't used here
#sm0 N0CALL-8 38400 255 2 test 1200
# Uncomment line below for a Serial TNC.
# Change the call to yours. Serial speed to TNC is used here
#ax0 N0CALL-8 19200 255 2 test 1200
# Uncomment line below for a yam.
# Change the call to yours. Speed isn't used here
#yam0 N0CALL-8 38400 255 2 test 1200
This and the configuration for your particular hardware is the minimum you will need for an outgoing connect.
Using a standard TNC
If you connect almost any TNC to your serial port, you will use the ax0 port line above. You will then need to know the speed of your TNC's serial interface and you will need to put the TNC into kiss mode (or use a kiss only eprom). For MOST TNC's you can connect to them using a terminal program (in linux, minicom is best) and use the command kiss on to activate kiss mode (often the power needs to be cycled at this point). Getting the modem out of kiss mode and back into normal packet mode can be done by resetting the modem or by sending it two character 255's together (this can be a little tricky).
Assuming you have properly cabled the TNC to the computer on the correct serial port, you are ready to start ax25:
/usr/sbin/kissattach -m 512 /dev/ttyS0 ax0 44.128.0.1
/usr/sbin/kissparms -p ax0 -t 300 -r 128 -s 100 -l 30
The first command means to start kiss creating an interface called ax0 on com1 using a max packet size of 512 bytes and an ip address of 44.128.0.1 (the address isn't important unless you are using TCP/IP. If you don't have an address and live in Minnesota, email me to get one). The second command sets some parameters on the TNC. The first parameter -t 300 is the most important, it means to use a transmit delay of 300 ms after keying the radio before sending the beginning of the data. This is a common setting for nearly all synthesized radios (which take about 300 ms to settle after keying). At this point you should be able to make an outgoing ax25 (normal packet) connect. The connect will use the CALL and SSID you used in the axports file. To call your friends mailbox (N0TL-3 for example) do:
call n0tl-3
And if everything is working OK you should get a split screen connect after a few seconds. To Exit your connect, simply log off of the remote system. To force a disconnect from your end, hit enter then type ~. and hit enter again. If you want to keep a list of stations heard by your TNC you can run the mheardd daemon:
/usr/sbin/mheardd
This will track anyone the TNC heard and will keep the list across sessions, reboots, whatever. To see a list of stations heard, simply run the mheard command.
Another useful command is listen. It shows all of the traffic on a port. Typical usage is listen -a -p ax0 In this example, the -p specifies the AX25 interface to listen on and the -a means to listen in both directions (incoming and outgoing). Hit control-c to exit listen.
Finally, here is an example of a script file I call doham to combine the commands from above along with some TCP/IP routing.

#!/bin/sh
# start ax25 on com1 using port defined in /etc/ax25/axports
/usr/sbin/kissattach -m 512 /dev/ttyS0 ax0 44.94.248.62
sleep 1
# Set TNC Parameters txd, persist, slottime, txtail
/usr/sbin/kissparms -p ax0 -t 300 -r 128 -s 100 -l 30
sleep 1
# route to the 145.05 gateway
/sbin/route add -host 44.94.11.8 dev ax0
# route to the rest of the netrom IP capable nodes
/sbin/route add -net 44.94.11.0 netmask 255.255.255.0 gw 44.94.11.8 dev ax0
# default route (do you REALLY want to do this) :)
# /sbin/route add default 44.94.11.8
sleep 1
# listen for various incoming connects like PMS, node, etc.
# (MUST first be configured in /etc/ax25/ax25d.conf)
/usr/sbin/ax25d
sleep 1
# listen for stations heard
/usr/sbin/mheardd

Using the Linux Soundmodem userspace driver with kernel AX.25
Either get the current Linux soundmodem userspace driver from the main site or the local copy here for your machine or one rev back for Debian stable using apt-get install soundmodem. Soundmodem uses the sound device in your PC to act as a DSP (digital signal processor) to replace the standard serial TNC. This has worked VERY well for me and has the advantage of saving the cost of the TNC. Since the soundmodem can do 9600 baud as well, this can save a few hundred dollars as of the end of 2004. Since your sound system has a stereo input and output the soundmodem driver can emulate a dual channel TNC which can be handy for those hams who drive multiple radios. There are only a couple of catches. One is that the end user needs to make a cable to their radio. The radio needs RCV, XMIT and PTT signals. The sound system provides RCV and XMIT however you have to use something else to get the PTT (push to talk) signal. Most implementations use the parallel port. Some also allow the use of a serial port. If you are using a modern laptop, you may have one or the other of these or perhaps NEITHER (in which case you are looking at a USBSerial converter just to get a line for PTT). If you are using a desktop you almost certainly have a parallel AND a serial port.

The parallel port PTT adapter is easiest to build in my opinion. This is what the parallel port circuitry looks like. (Note a 2N2222 works fine for the NPN transistor).

[Schematic PTT using Parallel Port]

Here is a link to the various PTT circuitry choices provided by the author of the soundmodem driver. A local copy is here in case the main site is down.
The soundmodem is configured using the soundmodemconfig program (click on thumbnails below to zoom). It's GUI based so you can't run it in text mode.
soundmodem config select driver soundmodem config TNC params soundmodem config modulator soundmodem config mod/demod choices
select driver "TNC" params modulator mod/demod choices
soundmodem config demodulator soundmodem config tcp params soundmodem config ax25 methods soundmodem diagnostics
demodulator tcp params ax25 methods diagnostics

Some VERY important tips. The receive volume is set by a combination of the radio volume control and the PC mic or line-in gain. The best way I found to set incoming volume is to setup a repeating ping on the frequency you are listening to with another station. Using the listen command vary the input gain and radio volume until you can copy packets optimally. You can also use the diagnostics section of soundmodemconfig to do this but the soundmodem daemon CAN'T be running while you are running in diagnostic mode. Note that if you only have a mic input on your PC (like my laptop) you will need to turn the gain way down on the PC. There is also a mic boost setting in the windows mixer control panel that should NOT be on.
Strangely enough, setting transmit volume is actually easier than setting receive volume when using 1200 AFSK. You can simply listen to the transmitted signal with another radio using the diagnostics mode in soundmodemconfig to turn on PTT then use the PC volume control to crank it up until the sound doesn't go any louder then back it off until it sounds like about half the volume it was at maximum. This should get you to around 3-4 KHZ deviation. Of course if you have a dev meter, use it!! Write the transmit volume setting down as well as the mic input setting and the radio volume setting for future reference. Of course you'll have to redo these settings if you go to a different PC. Finally, I operate with squelch fully open. I think the soundmodem driver does the equivalent of digital DCD to figure out whether the channel is busy or not. If you can't get the system to transmit though and you feel everything else is right, turn up the squelch just enough to quiet out the background signal. Once the soundmodem configuration is setup you can use a slight modification on the doham script above to bring up your AX25 system using the soundmodem driver.

#!/bin/sh
# start ax25 with the soundmodem driver using the port
# defined in /etc/ax25/axports
/usr/sbin/soundmodem /etc/ax25/soundmodem.conf -R -M >/dev/null 2>/dev/null&
sleep 1
# TNC Parameters txd, persist, slottime, txtail are done by
# soundmodemconfig and stored in soundmodem.conf
# route to the 145.05 gateway
/sbin/route add -host 44.94.11.8 dev sm0
# route to the rest of the netrom IP capable nodes
/sbin/route add -net 44.94.11.0 netmask 255.255.255.0 gw 44.94.11.8 dev sm0
# default route (do you REALLY want to do this) :)
# /sbin/route add default 44.94.11.8
sleep 1
# listen for various incoming connects like PMS, node, etc.
# (MUST first be configured in /etc/ax25/ax25d.conf)
/usr/sbin/ax25d
sleep 1
# listen for stations heard
/usr/sbin/mheardd

At this point you should be able to make an outgoing ax25 (normal packet) connect. The connect will use the CALL and SSID you used in the axports file. To call your friends mailbox (N0TL-3 for example) do:
call n0tl-3
And if everything is working OK you should get a split screen connect after a few seconds. To Exit your connect, simply log off of the remote system. To force a disconnect from your end, hit enter then type ~. and hit enter again.

Linux userspace (xNos for AX.25) Packet TCP/IP
There are a few different programs for doing AX.25 in a userspace program. These are nearly all derivatives of KA9Q NET written by Phil Karn a LONG time ago for MSDOS systems. In this environment, the net program itself had to simulate a multitasking operating system to do all of the client and server tasks associated with TCP/IP over AX.25.
Some of the popular variants include TNOS and JNOS here is a local copy of JNOS. Another version called WAMPES by (Dieter Deyke, DK5SG/N0PRA) was ported widely to *nix systems. Though it doesn't have the feature set of TNOS and JNOS it's very stable and available on the widest variety of platforms. The latest version of WAMPES is WAMPES-000304 (March 3rd 2000) on the TAPR ftp site, Linux directory. Since there is a requirement for a few instructions in assembly and there wasn't a version of WAMPES with PPC assembly in it, I ported it to PPC linux with help from Hollis Blanchard for the assembly portion.
I'm not going to get into setting up xNOS on linux here. You just need to know that it completely replaces the hamradio support in the linux kernel with a suite of programs and configurations. The config file for most NOS implementations is very similar. Here is a simple sample config file with comments in it for running a WAMPES debian ppc installation. The source code and pre-built binary tar archive are here. This requires a serial (rs232) port and a standard KISS TNC.

Mac OSX Packet TCP/IP (xNos for AX.25 only)
Porting WAMPES on PPC Linux and getting it working properly naturally led to an attempt to get it to work on mac OSX which is another PPC OS. Strangely enough, even though Linux and OSX share the same GCC compiler, their assembler is different! I needed help from Jonas Maebe on the darwin list to get the asm code right. It DOES work now and I BELIEVE that this is the first time that TCP/IP over AX.25 protocol has been spoken using OSX! Of course, this is completely text based and to try it out you need to run it in a shell. The interesting side to this though is that once you have WAMPES configured properly you can hook it to the OSX TCP/IP stack in your choice of a couple of different ways, run WAMPES in the background when you start the computer and forget it's there, it acts kind of like an AX25 cable or DSL router. You can then connect to radio based sites with TCP/IP over AX25 directly from OSX.
Here is a simple sample config file with comments in it for running a WAMPES OSX installation. The source code and pre-built binary tar archive are here. To install this (assuming you downloaded the most recent binary tar file to the desktop) do the following:

Download and install the tap driver from below
(tap is optional, it connects kernel tcp/ip to radio tcp/ip if you need that capability)
Open a terminal window (go->applications->utilities->terminal)
sudo /bin/sh
(type in your password when prompted)
cd /
tar zxf $HOME/Desktop/wampes-import-osx-bin.tar.gz
cd /tcp
Edit the net.rc file to match your radio call, ip address, etc.
Change the cu.modem port references in net.rc to ones that are for the serial device on your system.
If connecting kernel tcp to wampes with tap, edit the startnet file.
If you are not using the tap driver, do ./net to start wampes
Otherwise do ./startnet
This requires a serial (rs232) port and a standard KISS TNC. USB TNC's should work as well because they are just normal TNC's with an internal USBRS232 converter. On my Old-World Mac running OSX 10.3 I have two built-in serial ports called modem and printer. The devices to use are /dev/cu.printer or /dev/cu.modem depending on which port you are using. Now most new Macs don't have a serial port. In this case you will have to get a USBRS232 converter that works for OSX. I have a keyspan 28x that works fine (though the serial port is /dev/cu.USA28Xd17P1.1 for example which I think is really weird). Update 15 Dec 2005, I took the official source for WAMPES from Thomas Osterried applied my changes to it and got the TAP driver working so you can connect it to the OSX Kernel networking. You will need the OSX tun/tap driver for the tap device.

last modified Monday, December 1st, 2008
More information: http://www.qbjnet.com/packet.html

Tags: -

Related entries:

Last update: 2011-08-22 19:59
Author: Marcus
Revision: 1.1

Digg it! Share on Facebook Print this record Send FAQ to a friend Show this as PDF file
Propose a translation for Propose a translation for
Please rate this FAQ:

Average rating: 0 (0 Votes)

completely useless 1 2 3 4 5 most valuable

You can comment this FAQ