User Tools

Site Tools


tutorial-packet-on-pi

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial-packet-on-pi [2024/11/15 14:01] – [Choice of PC or Raspberry Pi?] kc2ihxtutorial-packet-on-pi [2025/11/30 21:26] (current) – [Other hardware?] n6cta
Line 1: Line 1:
-[[https://n6cta.com/2023/10/16/linux-packeteering-getting-started/|reformatting from N6CTA's blog post]] +====== FARPN PBBS on Raspberry Pi ======
- +
-====== Direwolf and LinBPQ on Raspberry Pi ====== +
  
 ====== Preface ====== ====== Preface ======
Line 9: Line 6:
 This is likely a weekend project at minimum if you have minimal Linux experience, but those with linux chops and BBS experience can likely get it all sorted in just a few hours. There’s no sugar coating the config files -- but taken as-is on a clean system, they should work well. This is likely a weekend project at minimum if you have minimal Linux experience, but those with linux chops and BBS experience can likely get it all sorted in just a few hours. There’s no sugar coating the config files -- but taken as-is on a clean system, they should work well.
  
-===== Why Direwolf? =====+==== Why Direwolf? ====
 N6CTA choose to use Direwolf as the software modem in this series as it appeared to the most performant and stable 300Bd FX.25 soft modem available for Linux. We've also investigated ''QtSoundModem'' and found it to be a little more challenging to use. This is still an imperfect solution as Direwolf doesn’t integrate as cleanly as it could with BPQ’s AGW driver. BPQ treats Direwolf (and all AGW ports) like a KISS TNC instead of allowing the TNC to handle some of the AX.25 stuff it’s good at. WB2OSZ’s OSI comments on why L1 and L2 need to be tightly coupled make a lot of sense and the AGW protocol allows for this kind of behavior but it does not appear to be implemented properly in BPQ. N6CTA choose to use Direwolf as the software modem in this series as it appeared to the most performant and stable 300Bd FX.25 soft modem available for Linux. We've also investigated ''QtSoundModem'' and found it to be a little more challenging to use. This is still an imperfect solution as Direwolf doesn’t integrate as cleanly as it could with BPQ’s AGW driver. BPQ treats Direwolf (and all AGW ports) like a KISS TNC instead of allowing the TNC to handle some of the AX.25 stuff it’s good at. WB2OSZ’s OSI comments on why L1 and L2 need to be tightly coupled make a lot of sense and the AGW protocol allows for this kind of behavior but it does not appear to be implemented properly in BPQ.
  
-===== Note on Debian as the OS ===== +==== Why linBPQ? ==== 
-Note: I am listing Debian package names for the libraries throughout the series. //If you’re on some other flavor, you’ll likely need to sort out the exact package names from your distribution’s repository.// No exotic libraries are being used though and if you can live with using your distribution’s versions of some of this software, by all means, use your repository’s packages. In the case of using a Raspberry Pi, it makes more sense to me to use Raspberry Pi OS (Debian Bookworm fork as of this writing) and compile the new software from source. We're recommending compiling from source for these components in order to get the latest and greatest, although this requires a little extra work to get set up and chance for new bugs.  +We’ve choosen linBPQ as it is cross-platform, source is made readily available via GitHub, and has a large and active community. One other important reason we chose linBPQ is the ease of which an operator can expand PBBS functionality through telnet. 
 + 
 +==== Note on Debian as the OS ==== 
 +Note: I am listing Debian package names for the libraries throughout the series. //If you’re on some other flavor, you’ll likely need to sort out the exact package names from your distribution’s repository.// No exotic libraries are being used though and if you can live with using your distribution’s versions of some of this software, by all means, use your repository’s packages. In the case of using a Raspberry Pi, it makes more sense to me to use Raspberry Pi OS (Debian Trixie fork as of this writing) and compile software from source. 
  
 //Boilerplate yadda yadda, YMMV. Let’s get on with it. // //Boilerplate yadda yadda, YMMV. Let’s get on with it. //
  
-====== Choice of PC or Raspberry Pi? ======+==== Choice of PC or Raspberry Pi? ====
  
 //Don’t overthink this part. You can likely use any machine built in the last 15-20 years.// //Don’t overthink this part. You can likely use any machine built in the last 15-20 years.//
Line 26: Line 26:
  
   * Already have a bunch for prototyping work from before the pandemic chip shortage   * Already have a bunch for prototyping work from before the pandemic chip shortage
-  * Were relatively inexpensive when bought them+  * Were relatively inexpensive when they were bought
   * Raspberry Pi OS is fairly stable now with a vast repository of working software   * Raspberry Pi OS is fairly stable now with a vast repository of working software
   * Other SBC's have varying level of update support for their OS, Raspberry Pi is consistently good about theirs   * Other SBC's have varying level of update support for their OS, Raspberry Pi is consistently good about theirs
-  * The SBC can easily be powered by my portable radio battery +  * The SBC can easily be powered by portable battery 
-  * Eventually solar power the whole shebang so managing power consumption is important to me+ 
 +===== Setting up the OS ===== 
 + 
 +==== On a Pi... ==== 
 + 
 +If you’re following along with a Pi, we wholeheartedly recommend using the Pi Imager tool to flash your memory card with. 
 + 
 +In Pi Imager you’ll want to click on the gear icon and set: 
 + 
 +  *  Set hostname 
 +  *  Enable SSH 
 +  *  Set user and password 
 +  *  Set locale 
 +  *  Configure Wireless LAN if necessary 
 + 
 +We’ll be using 64-bit software and OS. You can use a “lite” or “netinst” OS version if you’d like to but you won’t have the advantage of using QtTermTCP unless you install a window manager or desktop environment of some sort. The server daemon parts can be set up headless if you want to run the client side software over a network instead of via VNC. You can split the installation into client/server if you’d like to. This can easily be done using PiVPN so you can access (remote control – FCC 👀) your BBS from anywhere you have an internet connection. 
 + 
 +==== Other hardware? ==== 
 + 
 +If you’re undecided about what linux disto to use and you’re on some other hardware, //We recommend plain old Debian.// It’ll run smoothly on just about everything that isn’t in a museum. Just slap it on a USB stick using your OS’s disk imager of choice and let ‘er rip. It’s the DOOM of OS’s. 
 +==== Directories ==== 
 +We recommend setting up the software with these directories: 
 +<code> 
 +cd ~/.local && mkdir bin log src 
 +cd ~/.local/share/ && mkdir icons  
 +cd ~/.config && mkdir autostart linbpq direwolf qttermtcp hamlib  
 +</code> 
 + 
 +We'll use the ''bin'' directory for the executables we build later, the ''log'' directory for logs, and the ''src'' directory for the source code that we compile.  The ''share/icons'' directory is used by BPQ, and the configuration files will live in the appropriate subdirectory of ''~/.config/'' for each program. 
 + 
 +You may have your own preference for these, but we'll follow this for the rest of the tutorials. 
 + 
 +==== Installing dependencies ==== 
 +We recommend updating your system before we proceed and retrieving an up-to-date package list. 
 +<code> 
 +sudo apt update && sudo apt upgrade -y && sudo apt dist-upgrade -y && sudo apt autoremove -y && sudo apt clean -y && sudo reboot 
 +</code> 
 + 
 +When the machine reboots, the following is what you need to install to compile everything we’re going to use from source as well as some utilities for PBBS hardening. 
 +<code> 
 +sudo apt install -y qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5serialport5 libqt5serialport5-dev libfftw3-dev libasound2-dev libpcap-dev libminiupnpc-dev libconfig-dev autoconf libtool git gcc g++ make cmake libudev-dev qtmultimedia5-dev libreadline-dev libusb-1.0-0-dev libavahi-common-dev libavahi-client-dev libgps-dev libjansson-dev libpaho-mqtt-dev ufw fail2ban yggdrasil 
 +</code> 
 + 
 +==== Configuring for a "remote" machine ==== 
 +If you're going to run this "headless" AKA, without a monitor, or as a "remote" machine accessible from elsewhere, you'll want to enable the correct settings to join the network and start a VNC server (recommended if you want to use the GUI applications). This isn't strictly necessary, but nice to have. 
 + 
 +If you're on a Raspberry Pi, run: 
 +<code> 
 +sudo raspi-config 
 +</code> 
 + 
 +If you're on another system, you'll need to follow tutorials found elsewhere online. 
 + 
 +And then configure the following: 
 +  * System Options>Network at Boot 
 +  * System Options>Boot to Desktop (auto login) 
 +  * Interface Options>Enable VNC 
 +  * Display Options>VNC Resolution>1080p 
 + 
 +If you want RealVNC instead of WayVNC you’ll need to go back to Openbox WM with X11: 
 + 
 +  * Advanced Options>Wayland>X11 
 +  * Install RealVNC from the RealVNC website 
 + 
 +===== Compiling the pieces ===== 
 +The various components we need to use are all open source, and we recommend grabbing the source code release versions specifically mentioned here if listed. You can do this by running the following: 
 + 
 +<code> 
 +cd ~/.local/src/ 
 +git clone --branch 24.52 --single-branch https://github.com/g8bpq/linbpq.git 
 +git clone --branch 1.7 --single-branch https://github.com/wb2osz/direwolf.git 
 +git clone --branch 0.79 --single-branch https://github.com/g8bpq/QtTermTCP.git 
 +git clone https://github.com/Hamlib/Hamlib.git 
 +</code> 
 + 
 +Next we'll compile these pieces. 
 + 
 +//If you’re compiling on a pi ‘make -j6’ will allow you compile using all four cores which significantly speeds things up.// 
 + 
 +We recommend building in this order. 
 + 
 +==== Hamlib ==== 
 + 
 +<code> 
 +cd ~/.local/src/Hamlib/ 
 +./bootstrap 
 +./configure 
 +make 
 +export 
 +sudo make install 
 +sudo ldconfig 
 +</code> 
 + 
 +==== linbpq ==== 
 + 
 +<code> 
 +cd ~/.local/src/linbpq/ 
 +make 
 +cp linbpq ~/.local/bin/ 
 +cp *.ico ~/.local/share/icons/ 
 +</code> 
 + 
 +==== QtTermTCP ==== 
 + 
 +<code> 
 +cd ~/.local/src/QtTermTCP/ 
 +qmake 
 +make 
 +cp QtTermTCP ~/.local/bin/ 
 +cp QtTermTCP.ico ~/.local/share/icons/ 
 +</code> 
 + 
 +=== QtTermTCP Desktop/Menu Icon === 
 +Here are some suggestions for basic .desktop file entries for QtTermTCP. You’ll need to replace USER with your username. This will give you a nice shortcut in the applications menu.  The file should be created in ''~/.local/share/applications/qttermtcp.desktop'' 
 + 
 +<code> 
 +[Desktop Entry] 
 +Name=QTTermTCP 
 +Path=/home/USER/.config/qttermtcp/ 
 +Exec=QtTermTCP 
 +Icon=/home/USER/.local/share/icons/QtTermTCP.ico 
 +Terminal=false 
 +Type=Application 
 +</code> 
 + 
 +==== Direwolf ==== 
 + 
 +<code> 
 +cd ~/.local/src/direwolf 
 +mkdir build && cd build 
 +cmake .. 
 +make 
 +sudo make install 
 +</code> 
 + 
 +===== Software Configuration ===== 
 + 
 +==== Direwolf ==== 
 +I prefer to run multiple direwolf daemons instead of combining the configurations to run multiple modems. 
 + 
 +You'll create this file in ''~/.config/direwolf/direwolf.conf''. If you run multiple modems and would like to follow my lead, you'll just create multiple configs in the ''~/.config/direwolf/'' directory like ''~/.config/direwolf/direwolf_300.conf'' and ''~/.config/direwolf/direwolf_1200.conf''
 + 
 +**300Bd AFSK for HF** 
 + 
 +<code> 
 +#Audio 
 +ADEVICE0 pcm.300RX pcm.300TX 
 +ACHANNELS 1 
 +ARATE 48000 
 + 
 +CHANNEL 0 
 +#Modem 
 +MYCALL CALL 
 +MODEM 300 /1 
 +PACLEN 40 
 +FRACK 5 
 +MAXV22 0 
 +MAXFRAME 1 
 +FX25TX 1 
 + 
 +#PTT 
 +PTT RIG 2 localhost:4532 
 + 
 +#Control Port 
 +AGWPORT 8000 
 +KISSPORT 8001 
 +</code> 
 + 
 +**1200Bd AFSK for VHF/UHF** 
 + 
 +<code> 
 +#Audio 
 +ADEVICE0 pcm.1200RX pcm.1200TX 
 +ACHANNELS 1 
 +ARATE 48000 
 + 
 +CHANNEL 0 
 +#Modem 
 +MYCALL CALL 
 +MODEM 1200 /1 
 +PACLEN 256 
 +FRACK 3 
 +MAXV22 3 
 +MAXFRAME 7 
 +EMAXFRAME 7 
 +FX25TX 1 
 +V20 
 +CDIGIPEAT 0 0 YOUR_ALIAS 
 + 
 +#PTT 
 +PTT RIG 2 localhost:4533 
 + 
 +#Control Port                                                                                                              
 +AGWPORT 8002                                                                                                               
 +KISSPORT 8003 
 +</code> 
 + 
 +==== linBPQ ==== 
 +Here is an example configuration file for linBPQ. This should be created as ~/.config/linbpq/bpq32.cfg 
 +<code> 
 +;                                                     ; 
 +;                 linBPQ config File                  ; 
 +;                                                     ; 
 +;***************  Core Node Settings  ****************; 
 +LOCATOR=GRID                                          ; 
 +EnableM0LTEMap=1                                      ; 
 +MAPCOMMENT=                                           ; 
 +OBSINIT=3                                             ; Initial Obsolescence value 
 +OBSMIN=1                                              ; Minimum Obsolescence value to be included in NODES broadcasts 
 +L3TIMETOLIVE=20                                       ; Maximum Level 3 hops 
 +L4RETRIES=3                                           ; Level 4 Retries 
 +L4TIMEOUT=60                                          ; Level 4 Timeout 
 +L4DELAY=10                                            ; Level 4 Delayed ACK timer 
 +L4WINDOW=4                                            ; Level 4 Window 
 +PACLEN=256                                            ; Maximum Packet Length 
 +T3=300                                                ; Link Validation Timer 
 +IDLETIME=900                                          ; If there is no traffic for IDLETIME seconds, the link will be closed 
 +BBS=1                                                 ; This enables application support 
 +NODE=1                                                ; This allows users to connect to your node, and then connect out to other stations 
 +MAXLINKS=256                                          ; Maximum Level 2 lines (Uplink, Downlink and Internode) 
 +MAXNODES=1000                                         ; Number of Nodes (L4 destinations) 
 +MAXROUTES=144                                         ; Number of adjacent Nodes 
 +MAXCIRCUITS=160                                       ; Number of L4 Circults 
 +MINQUAL=191                                           ; Minimum Quality to add to NODES table 
 +HIDENODES=0                                           ; Suppresses the display of NODES with an Alias that starts with a # sign 
 +FULL_CTEXT=1                                          ; Displays connect text on connection 
 +AUTOSAVE=0                                            ; Save config on exit 
 +SAVEMH=0                                              ; Save MHeard list on exit 
 +ENABLE_LINKED=N                                       ; This controls the *** LINKED command 
 +NODESINTERVAL=30                                      ; Nodes broadcast interval 
 +IDINTERVAL=0                                          ; IDMSG is sent every IDINTERVAL minutes 
 +IDMSG: 
 +*** 
 +BTINTERVAL=0                                          ; BTEXT is the default beacon sent by the Node, every BTINTERVAL minutes 
 +LINMAIL                                               ; Starts linmail 
 +EXCLUDE=                                              ; Ban List 
 +;*****************************************************; 
 +;                                                     ; 
 +;****************  Personal Settings  ****************; 
 +NODECALL=CALL                                         ; Node callsign 
 +NODEALIAS=ALIAS                                       ; Node alias 
 +CTEXT: 
 +BPQ Node: ? for Help > 
 +*** 
 +Information about your node 
 +
 +*** 
 +;*****************************************************; 
 +;                                                     ; 
 +;**************   Port 1 VHF 1200Bd DW   *************; 
 +PORT                                                  ; 
 +  PORTNUM=1                                           ; 
 +  ID=1200Bd FX.25 145.050 MHz 
 +  Driver=UZ7HO 
 +  CHANNEL=A 
 +  PACLEN=236 
 +  MAXFRAME=7 
 +  QUALITY=192 
 +  MINQUAL=192 
 +  CONFIG 
 +  ADDR 127.0.0.1 8000 
 +ENDPORT  
 +;*****************************************************; 
 +;                                                     ; 
 +;***************   Port 2 HF 300Bd DW    *************; 
 +PORT                                                  ; 
 +  PORTNUM=2                                           ; 
 +  ID=300Bd FX.25 14.105 LSB 
 +  Driver=UZ7HO 
 +  CHANNEL=A 
 +  PACLEN=40 
 +  MAXFRAME=1 
 +  CONFIG 
 +  ADDR 127.0.0.1 8002 
 +ENDPORT                                               ; 
 +;*****************************************************; 
 +;                                                     ; 
 +;*******************  Port 3 AXUDP  ******************; 
 +PORT                                                  ; 
 +  PORTNUM=3                                           ; 
 +  ID=AXUDP                                            ; PORTS command text 
 +  DRIVER=BPQAXIP                                      ; Driver name 
 +  QUALITY=191                                         ; Default quality for nodes heard on this port 
 +  MINQUAL=191                                         ; Entries in the nodes table with qualities greater or equal to MINQUAL will be sent 
 +  MAXFRAME=7                                          ; Maximum outstanding frames  
 +  FRACK=3000                                          ; Level 2 delayed ack timer in milliseconds 
 +  RESPTIME=1000                                       ; Level 2 timout in milliseconds  
 +  RETRIES=10                                          ; Level 2 maximum retry value 
 +  PACLEN=256                                          ; Packet length 
 +  MHEARD=Y                                            ; MHeard list enable 
 +CONFIG                                                ;  
 +  UDP 10093,IPv6                                      ; Listen on port 
 +  UDP 10093                                           ; 
 +  BROADCAST NODES                                     ; Broadcast NODES beacons/info Add node BBSCALL IP TYPE PORT# B = Exchange NODES 
 +ENDPORT                                               ; 
 +;*****************************************************; 
 +;                                                     ; 
 +;******************  Port 4 Telnet  ******************; 
 +PORT                                                  ; 
 +  PORTNUM=4                                           ; Port number 
 +  ID=Telnet                                           ; PORTS command text 
 +  DRIVER=TELNET                                       ; Driver type 
 +  CONFIG                                              ; Driver specific configuration from here to ENDPORT 
 +  SECURETELNET=1                                      ; Restrict outbound telnet 
 +  LOGGING=1                                           ; Log all connections 
 +  DisconnectOnClose=0                                 ; Disconnect on close of application instead of return to node 
 +  TCPPORT=8010                                        ; Port for telnet connections 
 +  HTTPPORT=8008                                       ; Port for web interface 
 +  FBBPORT=8011                                        ; Port for FBB protocol BBS connections 
 +  CMDPORT=8015                                        ; Ports for APPS 
 +  LOGINPROMPT=u:                                      ; Telnet login prompt 
 +  PASSWORDPROMPT=p:                                   ;  
 +  RELAYAPPL=BBS                                       ; Relay CMS to BBS application instead of WL2K 
 +  LOCALECHO=NO                                        ; Do not echo input 
 +  MAXSESSIONS=10                                      ; Maxmimum simultaneous connections 
 +  LOCALNET=192.168.1.0/24                             ; LAN Subnet 
 +  CTEXT=BPQ Telnet Server\n'?' for Help>\n            ; Telnet connect message 
 +  USER=call,password,CALL,NODE,SYSOP                  ; Telnet user 
 +  USER=call-bbs,password,CALL,BBS,SYSOP               ; Telnet BBS user 
 +ENDPORT                                               ; 
 +;*****************************************************; 
 +;                                                     ; 
 +;**********************  ROUTES  *********************; 
 +;CALL,QUAL,PORT,MAXFRAME,FRACK,PACLEN,INP3Flag 
 +ROUTES: 
 +*** 
 +;*****************************************************; 
 +;                                                     ; 
 +;*******************  Applications  ******************; 
 +;1    2                        6        7       ; Application entry field order 
 +;#,BPQ CMD,BBS CMD EXE,CALL,ALIAS,QUALITY,L2ALIAS     ; Application entry field description 
 +APPLICATION 1,BBS,,CALL-1,ABCBBS,190                  ; BBS Application 
 +APPLICATION 2,K2K,C 4 HOST 0 K S,CALL,ABCK2K,190      ; K2K Application 
 +</code> 
 + 
 +If you only intend to run a single modem you'll want to adjust the config as follows: 
 +  
 +<code> 
 +;*****************************************************; 
 +;                                                     ; 
 +;***************   Port 1 HF 300Bd DW    *************; 
 +PORT                                                  ; 
 +  PORTNUM=1                                           ; 
 +  ID=300Bd FX.25 14.105 LSB 
 +  Driver=UZ7HO 
 +  CHANNEL=A 
 +  PACLEN=40 
 +  MAXFRAME=1 
 +  CONFIG 
 +  ADDR 127.0.0.1 8002 
 +ENDPORT                                               ; 
 +;*****************************************************; 
 +;                                                     ; 
 +;*******************  Port 2 AXUDP  ******************; 
 +PORT                                                  ; 
 +  PORTNUM=2                                           ; 
 +  ID=AXUDP                                            ; PORTS command text 
 +  DRIVER=BPQAXIP                                      ; Driver name 
 +  QUALITY=191                                         ; Default quality for nodes heard on this port 
 +  MINQUAL=191                                         ; Entries in the nodes table with qualities greater or equal to MINQUAL will be sent 
 +  MAXFRAME=7                                          ; Maximum outstanding frames  
 +  FRACK=3000                                          ; Level 2 delayed ack timer in milliseconds 
 +  RESPTIME=1000                                       ; Level 2 timout in milliseconds  
 +  RETRIES=10                                          ; Level 2 maximum retry value 
 +  PACLEN=256                                          ; Packet length 
 +  MHEARD=Y                                            ; MHeard list enable 
 +CONFIG                                                ;  
 +  UDP 10093,IPv6                                      ; Listen on port 
 +  UDP 10093                                           ; 
 +  BROADCAST NODES                                     ; Broadcast NODES beacons/info Add node BBSCALL IP TYPE PORT# B = Exchange NODES 
 +ENDPORT                                               ; 
 +;*****************************************************; 
 +;                                                     ; 
 +;******************  Port 3 Telnet  ******************; 
 +PORT                                                  ; 
 +  PORTNUM=3                                           ; Port number 
 +  ID=Telnet                                           ; PORTS command text 
 +  DRIVER=TELNET                                       ; Driver type 
 +  CONFIG                                              ; Driver specific configuration from here to ENDPORT 
 +  SECURETELNET=1                                      ; Restrict outbound telnet 
 +  LOGGING=1                                           ; Log all connections 
 +  DisconnectOnClose=0                                 ; Disconnect on close of application instead of return to node 
 +  TCPPORT=8010                                        ; Port for telnet connections 
 +  HTTPPORT=8008                                       ; Port for web interface 
 +  FBBPORT=8011                                        ; Port for FBB protocol BBS connections 
 +  CMDPORT=8015                                        ; Ports for APPS 
 +  LOGINPROMPT=u:                                      ; Telnet login prompt 
 +  PASSWORDPROMPT=p:                                   ;  
 +  RELAYAPPL=BBS                                       ; Relay CMS to BBS application instead of WL2K 
 +  LOCALECHO=NO                                        ; Do not echo input 
 +  MAXSESSIONS=10                                      ; Maxmimum simultaneous connections 
 +  LOCALNET=192.168.1.0/24                             ; LAN Subnet 
 +  CTEXT=BPQ Telnet Server\n'?' for Help>\n            ; Telnet connect message 
 +  USER=call,password,CALL,NODE,SYSOP                  ; Telnet user 
 +  USER=call-bbs,password,CALL,BBS,SYSOP               ; Telnet BBS user 
 +ENDPORT                                               ; 
 +;*****************************************************; 
 +;                                                     ; 
 +;**********************  ROUTES  *********************; 
 +;CALL,QUAL,PORT,MAXFRAME,FRACK,PACLEN,INP3Flag 
 +ROUTES: 
 +*** 
 +;*****************************************************; 
 +;                                                     ; 
 +;*******************  Applications  ******************; 
 +;1    2                        6        7       ; Application entry field order 
 +;#,BPQ CMD,BBS CMD EXE,CALL,ALIAS,QUALITY,L2ALIAS     ; Application entry field description 
 +APPLICATION 1,BBS,,CALL-1,ABCBBS,190                  ; BBS Application 
 +APPLICATION 2,K2K,C 3 HOST 0 K S,CALL,ABCK2K,190      ; K2K Application 
 +</code> 
 + 
 +==== Yggdrasil ==== 
 +FARPN has moved away from plain AXUDP and now we use a private Yggdrasil mesh to connect to each other using the internet. 
 + 
 +<code> 
 +sudo yggdrasil -genconf -json > /etc/yggdrasil/yggdrasil.conf 
 +</code> 
 + 
 +In the `yggdrasil.conf` file, edit your peers to add: 
 + 
 +  "Peers": ["tls://ip.n6cta.com:60573", "tls://yggdrasil.clitheroe.ca:23277"], 
 + 
 +I also strongly advise disabling the multicast interface: 
 + 
 +<code> 
 +"MulticastInterfaces": [], 
 +</code> 
 + 
 +A nice thing for gateway and mesh ops generally would be to also add something helpful here to let us know what the yggdrasil connected thing is like this: 
 + 
 +  "NodeInfo": {    
 +  "Name": "John Doe", 
 +  "Peer Type": "Client" 
 +  } 
 + 
 +===== PBBS Hardening ===== 
 + 
 +==== Audio - ALSA, maybe PipeWire, not Pulse ==== 
 + 
 +My personal preference is to get as close to the hardware as I can when it comes to audio applications. ALSA is that equivalent for Linux. PipeWire is much better than Pulse is/was but this tutorial is for a dedicated PBBS Pi and not a traditional desktop system so let's make sure pipewire and its helpers don't hijack our audio hardware. 
 + 
 +<code> 
 +systemctl --user stop pipewire.service pipewire.socket pipewire-pulse.service pipewire-pulse.socket wireplumber.service 
 +systemctl --user disable pipewire.service pipewire.socket pipewire-pulse.service pipewire-pulse.socket wireplumber.service 
 +systemctl --user mask pipewire.service pipewire.socket pipewire-pulse.service pipewire-pulse.socket wireplumber.service 
 +</code> 
 + 
 +Next we'll configure ALSA -- despite the jokes on the Internet, Linux audio isn't //that bad// for a simple case like ours.  That said, you’ll need to do some experimenting here but it shouldn’t be all that different from what we have below. You’ll need to know the sample rates supported by your device though. If you poke around in ''/proc/asound/'' you’ll find your card or you can run 'arecord -l' and 'aplay -l' to get a list of devices. 
 + 
 +For example, run ''cat /proc/asound/card3/stream0'': 
 +<code> 
 +Burr-Brown from TI USB Audio CODEC at usb-0000:01:00.0-1.1.4, full speed : USB Audio 
 + 
 +Playback: 
 +  Status: Stop 
 +  Interface 1 
 +    Altset 1 
 +    Format: S16_LE 
 +    Channels: 2 
 +    Endpoint: 0x02 (2 OUT) (ADAPTIVE) 
 +    Rates: 32000, 44100, 48000 
 +    Bits: 16 
 +    Channel map: FL FR 
 +</code> 
 + 
 +This is how you can set the default index for your USB audio card to force it to a consistent reboot safe value for the ALSA configuration. This can be done with even multiple USB audio interfaces. (ex. index=3,2,1) 
 + 
 +Edit ''/etc/modprobe.d/alsa-base.conf'' to add:  
 +<code> 
 +options snd_usb_audio index=3 
 +</code> 
 + 
 +Edit your ''/etc/asound.conf'' file to add a hardware alias to this device. 
 +<code> 
 +pcm.RX { 
 +    type dsnoop 
 +    ipc_key 1049 
 +    ipc_key_add_uid false 
 +    ipc_perm 0666 
 +    slave { 
 +        pcm "hw:3,0" 
 +        rate 48000 
 +        channels 1 
 +        } 
 +
 + 
 +pcm.TX { 
 +    type dmix 
 +    ipc_key 1048 
 +    ipc_key_add_uid false 
 +    ipc_perm 0666 
 +    slave { 
 +        pcm "hw:3,0" 
 +        rate 48000 
 +        channels 2 
 +        } 
 +
 + 
 +pcm.300RX {type rate slave {pcm "plug:RX" rate 48000}} 
 +pcm.300TX {type rate slave {pcm "plug:TX" rate 48000}} 
 +</code> 
 + 
 +If you had multiple interfaces like say an IC-9700 for 1200Bd VHF and an IC-7300 for HF the configuration could look like this: 
 + 
 +<code> 
 +pcm.7300RX { 
 +    type dsnoop 
 +    ipc_key 1049 
 +    ipc_key_add_uid false 
 +    ipc_perm 0666 
 +    slave { 
 +        pcm "hw:3,0" 
 +        rate 48000 
 +        channels 1 
 +        } 
 +
 + 
 +pcm.7300TX { 
 +    type dmix 
 +    ipc_key 1048 
 +    ipc_key_add_uid false 
 +    ipc_perm 0666 
 +    slave { 
 +        pcm "hw:3,0" 
 +        rate 48000 
 +        channels 2 
 +        } 
 +
 + 
 +<code> 
 +pcm.9700RX { 
 +    type dsnoop 
 +    ipc_key 1049 
 +    ipc_key_add_uid false 
 +    ipc_perm 0666 
 +    slave { 
 +        pcm "hw:4,0" 
 +        rate 48000 
 +        channels 1 
 +        } 
 +
 + 
 +pcm.9700TX { 
 +    type dmix 
 +    ipc_key 1048 
 +    ipc_key_add_uid false 
 +    ipc_perm 0666 
 +    slave { 
 +        pcm "hw:4,0" 
 +        rate 48000 
 +        channels 2 
 +        } 
 +
 + 
 +pcm.300RX {type rate slave {pcm "plug:RX7300" rate 48000}} 
 +pcm.300TX {type rate slave {pcm "plug:TX7300" rate 48000}} 
 +pcm.1200RX {type rate slave {pcm "plug:RX9700" rate 48000}} 
 +pcm.1200TX {type rate slave {pcm "plug:TX9700" rate 48000}} 
 +</code> 
 +==== Serial - udev rules ==== 
 +To make it reboot safe I would make a udev rule. Here is an example of mine. I use /dev/7300 as my CAT device in the above systemd entry as result of the entry below. The general idea is that you find a specific device identifier using the command below. 
 + 
 +Start by running ''udevadm info -q property -n /dev/ttyUSB0'', which will return information about the USB device: 
 +<code> 
 +DEVPATH=/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.0/ttyUSB0/tty/ttyUSB0 
 +DEVNAME=/dev/ttyUSB0 
 +MAJOR=188 
 +MINOR=0 
 +SUBSYSTEM=tty 
 +USEC_INITIALIZED=5003759 
 +ID_BUS=usb 
 +ID_MODEL=CP2102_USB_to_UART_Bridge_Controller 
 +ID_MODEL_ENC=CP2102\x20USB\x20to\x20UART\x20Bridge\x20Controller 
 +ID_MODEL_ID=ea60 
 +ID_SERIAL=Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_IC-7300_02058466 
 +ID_SERIAL_SHORT=IC-7300_02058466 
 +ID_VENDOR=Silicon_Labs 
 +ID_VENDOR_ENC=Silicon\x20Labs 
 +ID_VENDOR_ID=10c4 
 +ID_REVISION=0100 
 +ID_TYPE=generic 
 +ID_USB_MODEL=CP2102_USB_to_UART_Bridge_Controller 
 +ID_USB_MODEL_ENC=CP2102\x20USB\x20to\x20UART\x20Bridge\x20Controller 
 +ID_USB_MODEL_ID=ea60 
 +ID_USB_SERIAL=Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_IC-7300_02058466 
 +ID_USB_SERIAL_SHORT=IC-7300_02058466 
 +ID_USB_VENDOR=Silicon_Labs 
 +ID_USB_VENDOR_ENC=Silicon\x20Labs 
 +ID_USB_VENDOR_ID=10c4 
 +ID_USB_REVISION=0100 
 +ID_USB_TYPE=generic 
 +ID_USB_INTERFACES=:ff0000: 
 +ID_USB_INTERFACE_NUM=00 
 +ID_USB_DRIVER=cp210x 
 +ID_VENDOR_FROM_DATABASE=Silicon Labs 
 +ID_MODEL_FROM_DATABASE=CP210x UART Bridge 
 +ID_PATH=platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.1.1:1.0 
 +ID_PATH_TAG=platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_1_1_1_0 
 +ID_MM_CANDIDATE=1 
 +DEVLINKS=/dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.1.1:1.0-port0 /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_IC-7300_02058466-if00-port0 
 +TAGS=:systemd: 
 +CURRENT_TAGS=:systemd: 
 +</code> 
 + 
 +From there we want to grab some unique information to help identify this device as our transceiver and create a ''udev'' rules file for the device that'll give it a meaningful and consistent name. 
 + 
 +Add some variation of the following to a file in ''/etc/udev/rules.d/'' such as this example called ''80-IC-7300.rules'', using information about the device from ''udevinfo'' above: 
 + 
 +<code> 
 +ENV{MAJOR}!="?*", GOTO="7300_rules_end" 
 +SUBSYSTEMS=="usb-serial", GOTO="7300_usb_rules" 
 +GOTO="7300_rules_end" 
 + 
 +LABEL="7300_usb_rules" 
 + 
 +# Icom 7300 
 +ENV{ID_USB_SERIAL_SHORT} == "IC-7300_02058466", SYMLINK+="7300", MODE="660", GROUP="dialout" 
 + 
 +LABEL="7300_rules_end" 
 +</code> 
 + 
 +After creating the file, run ''sudo udevadm control --reload'' to create a new device called ''/dev/7300''
 + 
 +==== Firewall - UFW ==== 
 +We'll need to first make sure we've got IPv6 covered in UFW: 
 + 
 +<code>sudo nano /etc/ufw/ufw.conf</code> 
 + 
 +If it reads no change it to yes and if it is missing altogether, add it to the end of the file. 
 + 
 +<code> 
 +IPV6=yes 
 +</code> 
 + 
 +Next, we'll need to open port 22 so we don't lock ourselves out as well as applying sane defaults and starting the service. If you use a different internal subnet range you'll want to edit this to reflect it: 
 + 
 +<code> 
 +sudo ufw reload 
 +sudo ufw default deny incoming 
 +sudo ufw default allow outgoing 
 +sudo ufw allow from 192.168.1.0/24 to any port 22 proto tcp 
 +sudo ufw enable 
 +</code> 
 +==== Systemd Services ==== 
 + 
 +=== CAT/CIV - rigctld === 
 +  
 +Configuring rigctld is a crucial step to getting the rest of this setup running smoothly. The exact commands may be a little different depending on your gear. What we need is ''rigctld'' running in the background to give us a CAT/CIV interface to play with. 
 + 
 +You’ll need to change: 
 +  * ''USER'' to your username 
 +  * ''YOUR_RIG'' You’ll need to find the number for your rig by running ''rigctld -l | less'' 
 +  * ''CAT_DEVICE'': We set this up earlier using udev 
 +First we'll setup a ''systemd'' service for ''rigctld'' to make sure it comes up at boot, by creating the file ''/etc/systemd/system/rigctld.service'' with the following contents: 
 + 
 +<code> 
 +[Unit] 
 +Description=rigctld 
 +After=network-online.target 
 +Wants=network-online.target 
 + 
 +[Service] 
 +Type=simple 
 +Restart=always 
 +RestartSec=3 
 +User=USER 
 +Group=USER 
 +ExecStart=rigctld -m YOUR_RIG -r CAT_DEVICE -s PORT_SPEED 
 +SyslogIdentifier=rigctld 
 + 
 +[Install] 
 +WantedBy=multi-user.target 
 +</code> 
 + 
 +Then enable and start the service with: 
 +<code> 
 +sudo systemctl enable rigctld.service 
 +sudo systemctl start rigctld.service 
 +</code>
  
-====== Setting up the OS ======+If you have multiple radios, you'll need to run multiple daemons. Just name the services so that you'll recognize them ''rigctld_7300.service'' ''rigctld_9700.service'' etc. You'll also need to use the option -t as shown below to set different port numbers to listen on. The default TCP 4532
  
-====== Compiling the pieces ======+<code> 
 +ExecStart=rigctld -m YOUR_RIG -r CAT_DEVICE -s PORT_SPEED -t LISTEN_PORT 
 +</code>
  
-====== Audio - ALSA, not Pulse ======+If for whatever reason you need to make an edit to a systemd service entry you’ll need to reload systemd and start the service again.
  
-====== rigctld (and udev rules) ======+<code> 
 +sudo systemctl daemon-reload 
 +sudo systemctl restart rigctld.service 
 +</code>
  
 +To check on the status of a service we use the ‘status’ command. At the bottom of the output we’ll get essentially a tail of ''stdout'' (the program's standard output). This is super handy for checking out issues.
  
 +<code>
 +sudo systemctl status rigctld.service
 +</code>
  
 +If we want to get really fancy we can get a running live log of the service using journalctl. The -f option gives a ‘tail -f’ like output. I use this so much I have a short alias for watching the output of my BBS services. I much prefer this to using screen because we get logging for troubleshooting and many of these daemons cannot take terminal input once run anyway.
  
 +<code>
 +journalctl -u rigctld.service -f
 +</code>
  
 +=== Modem - Direwolf ===
 +Create file ''/etc/systemd/system/direwolf.service'' with the following contents, enabled, and started:
 +<code>
 +[Unit]
 +Description=Direwolf
 +After=rigctld.service
 +Requires=rigctld.service
 +BindsTo=rigctld.service
 +PartOf=rigctld.service
  
 +[Service]
 +Type=simple
 +Restart=always
 +RestartSec=3
 +User=USER
 +Group=USER
 +ExecStart=/usr/local/bin/direwolf -a 10 -q d -t 0 -c /home/USER/.config/direwolf/direwolf.conf
  
 +[Install]
 +WantedBy=multi-user.target
 +</code>
  
 +=== BBS - linBPQ ===
 +Create file ''/etc/systemd/system/linbpq.service'' with the following contents, enabled, and started:
 +<code>
 +[Unit]
 +Description=linBPQ
 +After=yggdrasil.service
 +After=direwolf.service
 +Requires=yggdrasil.service
 +BindsTo=yggdrasil.service
 +PartOf=yggdrasil.service
  
 +[Service]
 +Type=simple
 +Restart=always
 +RestartSec=3
 +WorkingDirectory=/home/USER/.config/linbpq/
 +User=USER
 +Group=USER
 +ExecStart=/home/USER/.local/bin/linbpq
  
 +[Install]
 +WantedBy=multi-user.target
 +</code>
  
 +=== Mesh - Yggdrasil ===
 +This should have been created and enabled but you can make sure by running:
 +<code>
 +sudo systemctl enable yggdrasil.service
 +sudo systemctl restart yggdrasil.service
 +</code>
tutorial-packet-on-pi.1731679302.txt.gz · Last modified: by kc2ihx