Events

:

:

Elektronik | Funk | Software

Der Technik-Blog

  • Social Media

    YouTube

    Werbung:


    New Posts


    Events

    • Keine zukünftigen Events vorhanden

    The Tech-Blog

    LoRaWAN Packet Recorder Setup

    Packet Recorder (Linux)

    Alex @ AEQ-WEB

    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.


    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.

    Database Setup

    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:

    Werbung:

    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:

    Setting Up the Web Interface

    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:

    Werbung:

    The web interface can be accessed via a web browser at http://localhost/packet-recorder:

    Registering the Program as a Service

    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!

    Werbung:

    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:



    Info: This page was automatically translated and may contain errors
    122X122

    About the Author

    Alex, the founder of AEQ-WEB. He works for more of 10 years with different computers, microcontroller and semiconductors. In addition to hardware projects, he also develops websites, apps and software for computers.

    Top articles in this category:

    Vaisala RS41 Radiosonde Firmware Flash

    Radiosonde RS41 Firmware Flash

    • Video
    • DE/EN

    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 more
    TTGO LILYGO GPS Problem

    TTGO/LILYGO GPS-Problem

    • Video
    • DE/EN

    With 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 more

    Social Media

    YouTube

    Werbung:


    New Posts


    Events

    • Keine zukünftigen Events vorhanden