User Tools

Site Tools


packet:kernel-ax25-pi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
packet:kernel-ax25-pi [2023/04/12 21:20] – initial version m0gzppacket:kernel-ax25-pi [2023/04/16 23:40] (current) – Updating m0gzp
Line 1: Line 1:
 ===== Raspberry Pi and Linux Kernel AX.25 support ===== ===== Raspberry Pi and Linux Kernel AX.25 support =====
  
-This page documents how set up my Raspberry Pi running Raspbian Lite (32 bit).+This page documents how to set up Raspberry Pi running Raspberry Pi OS Lite (32 bit), and was written by Szymon M0GZP. 
 + 
 +It is possible to do this on 64 bit Raspberry Pi OS as well, so long as you are consistently using 32 bit or 64 bit throughout; see the notes below. 
 + 
 +Alternative reading: 
 + 
 +[[https://www.elite.uk.com/mike/posts/linux-netrom-setup/|Mike has also written up]] a guide on his own site for configuring all the bits. 
 + 
 +There is also documentation in TLDP: [[https://tldp.org/HOWTO/Netrom-Node-5.html]]
  
 ==== Equipment ==== ==== Equipment ====
  
-My setup consists of:+This example setup consists of:
   * Raspberry Pi 4b   * Raspberry Pi 4b
   * CG Antenna 2000 Radio Interface   * CG Antenna 2000 Radio Interface
Line 11: Line 19:
   * Tait 2010 VHF Radio   * Tait 2010 VHF Radio
   * ICOM IC7300 HF Radio   * ICOM IC7300 HF Radio
 +
 +but the same principles apply with different radios, audio and radio interfaces.
  
 ==== Software Prereqs ==== ==== Software Prereqs ====
 ''sudo apt install libax25 ax25-apps ax25-tools socat direwolf'' ''sudo apt install libax25 ax25-apps ax25-tools socat direwolf''
 +
 +You do not need to install socat or direwolf packages if you will be using a hardware TNC such as NinoTNC.
  
 Notes: Notes:
   * make absolutely certain that you are using a 32bit kernel if you have 32bit user binaries.  I somehow ended up with a 64bit kernel and things broke in very subtle ways.  Check that ''uname -m'' returns ''armv7l'' if you installed a 32bit OS!   * make absolutely certain that you are using a 32bit kernel if you have 32bit user binaries.  I somehow ended up with a 64bit kernel and things broke in very subtle ways.  Check that ''uname -m'' returns ''armv7l'' if you installed a 32bit OS!
-  * you may need to use ''api-update'' to get the latest series 6 kernel+  * you currently need to use ''rpi-update'' to get the latest series 6 kernel - there are unfixed AX.25 bugs in the version 5 kernel available at the time of writing.
  
 ==== TNC ==== ==== TNC ====
-I use Direwolf to run the two radios.  Here is my Direwolf config:+The author uses Dire Wolf to run the two radios. Dire Wolf is a fundamentally a KISS modem implemented in software and using a sound card. An alternative to using a sound card based KISS modem is to use a hardware device such as NinoTNC. The same overall steps still apply, just using a piece of hardware as the modem instead of a piece of software. 
 + 
 +Here is a suitable Dire Wolf config:
  
 <code> <code>
Line 58: Line 72:
 This file sets up two AX.25 ports, one for VHF and one for HF This file sets up two AX.25 ports, one for VHF and one for HF
 <code> <code>
-v144    M0GZP-1         19200   236     4       144.375 Mhz 1k2bps +VHF     M0GZP-1         19200   255     4       144.375 Mhz 1k2bps 
-HF      M0GZP-2         19200   236     4       HF 300bps+HF      M0GZP-2         19200   200     4       HF 300bps
 </code> </code>
  
Line 65: Line 79:
 This file sets up a NET/ROM port aliased as GZPNOD This file sets up a NET/ROM port aliased as GZPNOD
 <code> <code>
-netrom  M0GZP-7 GZPNOD  236     Linux Switch Port+nrvhf   M0GZP-5 GZPVHF  235     VHF NET/ROM Port 
 +nrhf    M0GZP-6 GZPHF   40      HF NET/ROM Port
 </code> </code>
 +
 +NOTE: nrports cannot contain any blank lines.
  
 === nrbroadcast === === nrbroadcast ===
-This file configures how our AX.25 ports will broadcast NET/ROM nodes.  My VHF node sets all seen nodes to a default quality of 220, and will broadcast any node with a minimum quality of 200.  The HF node on the other hand sets all nodes to a default quality of 199 (so as not to advertise HF nodes over VHF), and will broadcast nodes with a minimum quality of 199.+This file configures how our AX.25 ports will broadcast NET/ROM nodes.  My VHF node sets all seen nodes to a default quality of 220, and will broadcast any node with a minimum quality of 200.  The HF node on the other hand sets all nodes to a default quality of 200 (so as not to advertise HF nodes over VHF), and will broadcast nodes with a minimum quality of 200.
 <code> <code>
-v144    5       220     200     1 +VHF     5       200     200     1 
-HF      5       199     199     1+HF      5       220     200     1 
 +</code> 
 + 
 +=== ax25d.conf === 
 +This file configures the ax25 userspace daemon, which determines what processes are run when other users connect in to the node.  In my example, I am calling the program uronode (by N1URO, sadly SK).  A separate entry is required for each port. 
 +<code> 
 +[M0GZP-1 via VHF] 
 +NOCALL   * * * * * *  L 
 +default  * * * * * *  0 root  /usr/local/sbin/uronode   uronode 
 + 
 +[M0GZP-2 via HF] 
 +NOCALL   * * * * * *  L 
 +default  * * * * * *  0 root  /usr/local/sbin/uronode   uronode 
 + 
 +<nrhf> 
 +NOCALL   * * * * * *  L 
 +default  * * * * * *  0 root  /usr/local/sbin/uronode   uronode 
 + 
 +<nrvhf> 
 +NOCALL   * * * * * *  L 
 +default  * * * * * *  0 root  /usr/local/sbin/uronode   uronode
 </code> </code>
  
Line 85: Line 122:
   * Load the ''netrom'' module and attach it to the port defined in nrports   * Load the ''netrom'' module and attach it to the port defined in nrports
   * Run the netrom userspace daemon which handles the netrom broadcasts   * Run the netrom userspace daemon which handles the netrom broadcasts
 +  * Load previous netrom node tables
 +  * Run the mheard daemon which keeps track of heard stations
 +  * Run the ax25 daemon to support running services
 <code> <code>
 #!/bin/bash #!/bin/bash
Line 93: Line 133:
 echo Done echo Done
 echo -n Attaching KISS interfaces for direwolf... echo -n Attaching KISS interfaces for direwolf...
-kissattach `ls -l /tmp/kiss8001 | awk '{ print $11 }'v144+kissattach -l `ls -l /tmp/kiss8001 | awk '{ print $11 }'VHF
 sleep 1 sleep 1
-kissattach `ls -l /tmp/kiss8002 | awk '{ print $11 }'` HF+kissattach -l `ls -l /tmp/kiss8002 | awk '{ print $11 }'HF 
 +sleep 1 
 +echo Done 
 +echo -n 'Bringing up NET/ROM runtime...' 
 +modprobe netrom 
 +nrattach nrvhf 
 +nrattach nrhf 
 +netromd -i -l -d 
 +echo -n Restoring node tables... 
 +[ -x /etc/ax25/nodesave.sh ] && /etc/ax25/nodesave.sh 
 +echo Done 
 +echo -n Starting mheard daemon... 
 +mheardd -l 
 +echo Done 
 +echo -n Starting ax25 daemon... 
 +ax25d -l 
 +echo Done 
 +</code> 
 + 
 +For a modem other than Dire Wolf, an alternative script can be used: 
 + 
 +<code> 
 +#!/bin/bash 
 +echo -n Attaching KISS interfaces... 
 +kissattach /dev/ttyACM0 HF
 sleep 1 sleep 1
 echo Done echo Done
Line 106: Line 170:
 echo Done echo Done
 </code> </code>
 +
 +NB this script appears to run before /dev/ttyACM0 is available, so currently doesn't work. I'm coming up with a fix.
  
 === /usr/sbin/stopRadio.sh === === /usr/sbin/stopRadio.sh ===
 This script does the opposite to startRadio, killing the processes and taking down the interfaces This script does the opposite to startRadio, killing the processes and taking down the interfaces
 +<code>
 +#!/bin/bash
 +echo -n Saving node tables...
 +/usr/sbin/nodesave > /etc/ax25/nodesave.sh && chmod 755 /etc/ax25/nodesave.sh
 +echo Done
 +echo -n Killing mheard daemon...
 +killall mheardd
 +sleep 1
 +echo Done
 +echo -n Killing ax25 daemon...
 +killall ax25d
 +sleep 1
 +echo Done
 +echo -n Killing all socat processes in case they do not end cleanly...
 +killall socat
 +sleep 1
 +echo Done
 +echo -n Killing all kissattach processes...
 +killall kissattach
 +sleep 1
 +echo Done
 +echo -n Killing the netromd process...
 +killall netromd
 +sleep 1
 +echo Done
 +echo -n Taking down the netrom interface...
 +ifconfig nr0 down
 +sleep 1
 +echo Done
 +echo -n Removing kernel modules...
 +rmmod netrom && sleep 1 && rmmod mkiss && sleep 1 && rmmod ax25 && sleep 1
 +echo Done
 +echo -n Taking down the AX.25 interfaces...
 +ifconfig ax0 > /dev/null 2>&1 && ifconfig ax0 down
 +ifconfig ax1 > /dev/null 2>&1 && ifconfig ax1 down
 +sleep 1
 +echo Done
 +</code>
 +
 +For a modem other than Dire Wolf, an alternative script can be used:
 +
 <code> <code>
 #!/bin/bash #!/bin/bash
Line 115: Line 222:
 echo Killing all kissattach processes echo Killing all kissattach processes
 killall kissattach killall kissattach
-echo Killing all socat processes in case they do not end cleanly 
-killall socat 
 echo Killing the netromd process echo Killing the netromd process
 killall netromd killall netromd
Line 127: Line 232:
 echo Taking down the AX.25 interfaces echo Taking down the AX.25 interfaces
 ifconfig ax0 > /dev/null 2>&1 && ifconfig ax0 down ifconfig ax0 > /dev/null 2>&1 && ifconfig ax0 down
-ifconfig ax1 > /dev/null 2>&1 && ifconfig ax1 down 
 echo Done echo Done
 +</code>
 +
 +Don't forget to make these scripts executable:
 +
 +<code>
 +chmod +x /usr/sbin/startRadio.sh
 +chmod +x /usr/sbin/stopRadio.sh
 </code> </code>
  
Line 136: Line 247:
 [Unit] [Unit]
 Description=Start up radio processes Description=Start up radio processes
 +After=direwolf.service
 +Requires=direwolf.service
  
 [Service] [Service]
Line 154: Line 267:
 ● ax25.service - Start up radio processes ● ax25.service - Start up radio processes
      Loaded: loaded (/lib/systemd/system/ax25.service; disabled; vendor preset: enabled)      Loaded: loaded (/lib/systemd/system/ax25.service; disabled; vendor preset: enabled)
-     Active: active (exited) since Wed 2023-04-12 22:16:27 BST; 4s ago +     Active: active (exited) since Mon 2023-04-17 00:36:38 BST; 7s ago 
-    Process: 2476 ExecStart=/usr/sbin/startRadio.sh (code=exited, status=0/SUCCESS) +    Process: 3036 ExecStart=/usr/sbin/startRadio.sh (code=exited, status=0/SUCCESS) 
-   Main PID: 2476 (code=exited, status=0/SUCCESS) +   Main PID: 3036 (code=exited, status=0/SUCCESS) 
-      Tasks: (limit: 4915) +      Tasks: (limit: 4915) 
-        CPU: 151ms+        CPU: 156ms
      CGroup: /system.slice/ax25.service      CGroup: /system.slice/ax25.service
-             ├─2477 socat pty,echo=0,link=/tmp/kiss8001,wait-slave tcp:127.0.0.1:8001 +             ├─3037 socat pty,echo=0,link=/tmp/kiss8001,wait-slave tcp:127.0.0.1:8001 
-             ├─2478 socat pty,echo=0,link=/tmp/kiss8002,wait-slave tcp:127.0.0.1:8002 +             ├─3038 socat pty,echo=0,link=/tmp/kiss8002,wait-slave tcp:127.0.0.1:8002 
-             ├─2486 kissattach /dev/pts/v144 +             ├─3047 kissattach -l /dev/pts/VHF 
-             ├─2501 kissattach /dev/pts/HF +             ├─3061 kissattach -l /dev/pts/HF 
-             2519 netromd -i -l -d+             3089 netromd -i -l -d 
 +             ├─3099 mheardd -l 
 +             └─3104 ax25d -l
  
-Apr 12 22:16:25 radio startRadio.sh[2483]: AX.25 port v144 bound to device ax0 +Apr 17 00:36:38 radio startRadio.sh[3077]: NET/ROM port nrvhf bound to device nr0 
-Apr 12 22:16:25 radio startRadio.sh[2486]: AX.25 port v144 bound to device ax0 +Apr 17 00:36:38 radio startRadio.sh[3082]: NET/ROM port nrhf bound to device nr1 
-Apr 12 22:16:26 radio startRadio.sh[2499]: AX.25 port HF bound to device ax1 +Apr 17 00:36:38 radio netromd[3089]: starting 
-Apr 12 22:16:26 radio startRadio.sh[2501]: AX.25 port HF bound to device ax1 +Apr 17 00:36:38 radio startRadio.sh[3036]: Restoring node tables...Done 
-Apr 12 22:16:27 radio startRadio.sh[2476]: Done +Apr 17 00:36:38 radio mheardd[3099]: starting 
-Apr 12 22:16:27 radio startRadio.sh[2476]: Bringing up NET/ROM runtime... +Apr 17 00:36:38 radio startRadio.sh[3036]: Starting mheard daemon...Done 
-Apr 12 22:16:27 radio startRadio.sh[2512]: NET/ROM port netrom bound to device nr0 +Apr 17 00:36:38 radio startRadio.sh[3036]: Starting ax25 daemon...Done 
-Apr 12 22:16:27 radio netromd[2519]: starting +Apr 17 00:36:38 radio systemd[1]: Finished Start up radio processes. 
-Apr 12 22:16:27 radio startRadio.sh[2476]: Restoring node tables...Done +Apr 17 00:36:38 radio ax25d[3104]: starting 
-Apr 12 22:16:27 radio systemd[1]: Finished Start up radio processes.+Apr 17 00:36:38 radio ax25d[3104]: new config file loaded successfully
 szymon@radio:~ $  szymon@radio:~ $ 
 </code> </code>
Line 181: Line 296:
 You will see some new network interfaces on ifconfig (I've removed my normal interfaces): You will see some new network interfaces on ifconfig (I've removed my normal interfaces):
 <code> <code>
-ax0: flags=67<UP,BROADCAST,RUNNING>  mtu 236+ax0: flags=67<UP,BROADCAST,RUNNING>  mtu 255
         ax25 M0GZP-1  txqueuelen 10  (AMPR AX.25)         ax25 M0GZP-1  txqueuelen 10  (AMPR AX.25)
         RX packets 0  bytes 0 (0.0 B)         RX packets 0  bytes 0 (0.0 B)
         RX errors 0  dropped 0  overruns 0  frame 0         RX errors 0  dropped 0  overruns 0  frame 0
-        TX packets  bytes 77 (77.0 B)+        TX packets  bytes 49 (49.0 B)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  
-ax1: flags=67<UP,BROADCAST,RUNNING>  mtu 236+ax1: flags=67<UP,BROADCAST,RUNNING>  mtu 200
         ax25 M0GZP-2  txqueuelen 10  (AMPR AX.25)         ax25 M0GZP-2  txqueuelen 10  (AMPR AX.25)
         RX packets 0  bytes 0 (0.0 B)         RX packets 0  bytes 0 (0.0 B)
         RX errors 0  dropped 0  overruns 0  frame 0         RX errors 0  dropped 0  overruns 0  frame 0
-        TX packets  bytes 77 (77.0 B)+        TX packets  bytes (0.0 B)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  
-nr0: flags=193<UP,RUNNING,NOARP>  mtu 236 +nr0: flags=193<UP,RUNNING,NOARP>  mtu 235 
-        netrom M0GZP- txqueuelen 1000  (AMPR NET/ROM)+        netrom M0GZP-5  txqueuelen 1000  (AMPR NET/ROM) 
 +        RX packets 0  bytes 0 (0.0 B) 
 +        RX errors 0  dropped 0  overruns 0  frame 0 
 +        TX packets 0  bytes 0 (0.0 B) 
 +        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 
 + 
 +nr1: flags=193<UP,RUNNING,NOARP>  mtu 40 
 +        netrom M0GZP-6  txqueuelen 1000  (AMPR NET/ROM)
         RX packets 0  bytes 0 (0.0 B)         RX packets 0  bytes 0 (0.0 B)
         RX errors 0  dropped 0  overruns 0  frame 0         RX errors 0  dropped 0  overruns 0  frame 0
Line 204: Line 326:
  
 You can now use ''axcall'' to contact another node, ''axlisten'' to monitor traffic, etc. You can now use ''axcall'' to contact another node, ''axlisten'' to monitor traffic, etc.
 +
 +If it was all successful, enable the service to start at boot:
 +
 +<code>
 +sudo systemctl enable ax25.service
 +</code>
packet/kernel-ax25-pi.1681334420.txt.gz · Last modified: 2023/04/12 21:20 by m0gzp