Packet Recorder (Linux)
25.02.2025
Elektronik | Funk | Software
Der Technik-Blog
The Packet Recorder logs all LoRaWAN uplink messages and stores them in a MySQL or MariaDB database. This tool can identify, based on the Device Address, which LoRaWAN network operator a message belongs to. The program opens a socket on UDP port 1700 (similar to the UDP Packet Forwarder), where all data from a gateway is received and stored in a database.
Download Packet Recorder Source Code & Program
Source Code Compilation on Linux
Basics of Semtech UDP Packet Forwarder
Structure of a LoRaWAN Uplink Message
Programming Hello World in C++ on Windows with CMake
LoRaWAN Basics: Device Address & NetID
Note: This program requires a connection to a MySQL or MariaDB database server with native authentication. Encrypted connections, which are generally not required for a local database connection, are currently not supported.
The program is provided as an executable file (./) and requires a MySQL or MariaDB database server with native authentication. Additionally, ensure that a firewall does not block incoming traffic on port 1700.
Furthermore, this program requires the installation of a web server (Apache or Nginx) with PHP.
The phpMyAdmin tool is used for database management. Navigate to the "User Accounts" section to create a new user on the local machine with native authentication. At the same time, a new database should also be created:
Alongside the ./PacketRecorder file, there is another file in the directory named config.ini. This file must contain all the necessary information for the database connection. The username, password, and database name should be specified as previously defined in phpMyAdmin:
Once the config file has been properly edited, the program can be started. If the socket on UDP port 1700 is successfully opened and a connection to the database server is established, the program output will appear as follows:
The web interface is contained within a single file, index.php. To configure it, create a new folder named packet-recorder in the web server’s root directory (/var/www/html/) and copy the index.php file into this folder. Open the file using a text editor and update it with the necessary database connection parameters, including the username, password, and database name. This completes the setup, enabling the web interface to interact seamlessly with the database:
The web interface can be accessed via a web browser at http://localhost/packet-recorder:
If the Packet Recorder should run continuously, it can be installed as a service. This ensures the program starts automatically immediately after the system boots and runs in the background. Under Linux, the /opt directory is a suitable location for the program files. In this directory, create a new folder named packetrecorder using the terminal:
cd /opt sudo mkdir packetrecorder
The files (`config.ini` and `PacketRecorder`) are copied into the newly created folder. Then, a new user is created with the following commands, assigned as the owner of the folder, and permissions are granted for all:
sudo useradd -r -s /bin/false packetrecorder sudo chown packetrecorder:packetrecorder PacketRecorder chmod 0777 -R packetrecorder
Now, a new service is set up using the Nano text editor:
sudo nano /etc/systemd/system/PacketRecorder.service
The following content is written into the text file:
[Unit] Description=PacketRecorder Service After=network.target mysql.service Requires=mysql.service [Service] Type=simple ExecStart=/opt/packetrecorder/PacketRecorder WorkingDirectory=/opt/packetrecorder Restart=always User=packetrecorder Group=packetrecorder [Install] WantedBy=multi-user.target
For a successful system startup, the MySQL or MariaDB database server must already be running. The Packet Recorder will only start after the database server has been started. Additionally, there is a 10-second delay. Note: This example is configured for a MySQL server. If you are using MariaDB, you must adjust the file accordingly!
The service must then be enabled and started:
sudo systemctl daemon-reload
sudo systemctl enable PacketRecorder.service
sudo systemctl start PacketRecorder.service
sudo systemctl status PacketRecorder.service
The last command checks if the service started successfully:
Every day hundreds of meteorological radiosondes fall from the sky. In this article we convert a radiosonde into a GPS tracker for APRS, RTTY & CW
read moreWith newer versions of TTGO & LILYGO LoRaWAN GPS boards there are problems with the serial processing of GPS data. The reason is the deactivation of NMEA
read moreAEQ-WEB © 2015-2025 All Right Reserved