Setup the infrastructure

To setup a complete ChirpStack stack, please refer to the official documentation.

Register the gateway in the ChirpStack server

Once the server is running, register the gateway from the ChirpStack GUI.

Setup the ChirpStack Gateway Bridge

With ChirpStack, the gateway will communicate with a single software component: the ChirpStack Gateway Bridge.

ChirpStack offers two possibilities:

  1. Running the Gateway Bridge on the gateway
  2. Running the Gateway Bridge on the server

We recommend running the Bridge on the gateway directly. This guide proposes this solution. If you want to run the Bridge on the server, please use the UDP Packet Forwarder configuration and refer to the ChirpStack documentation.

Activate the bridge

You can now connect to the gateway to enable the ChirpStack gateway bridge as the active forwarder. It is already installed on your gateway.

  1. On the LoRa Settings page, on the FORWARDER tab, use the top right edit button.
  2. In the “Change forwarder” popup, select the ChirpStack Gateway Bridge and press Apply.

Now that the ChirpStack Gateway Bridge is the active forwarder, you can see his two configuration sections:

  1. Bridge configuration
  2. Backend configuration

sudo manager lora forwarder set chirpstack-gateway-bridge
BASH
setting active forwarder to 'chirpstack-gateway-bridge'...        done

Configure the bridge

Backend and frontend

The ChirpStack Gateway Bridge, the front-end, does not access the hardware directly, instead it interacts with a packet forwarder on the gateway, the back-end.

The default configuration of the LORIX already connects the back-end to the front-end through the port 1700.

About localhost

The default address for the back-end and the front-end to communicate is set to 127.0.0.1. This address is called 'localhost' (or loopback address) and is assigned by default in any device. Keeping this address will always make the back-end and the front-end communicate internally on the gateway only.

Configure the front-end

Use the edit button on the right in the "Bridge configuration" section.

In the "Integration configuration" > [integration.mqtt.auth.generic] section, update the server, username, and password fields with the address of your network server and the credentials configured on the server and save the configuration.

Example

# This configuration provides a Semtech UDP packet-forwarder backend and
# integrates with a MQTT broker. Many options and defaults have been omitted
# for simplicity.
#
# See https://www.chirpstack.io/gateway-bridge/install/config/ for a full
# configuration example and documentation.


# Gateway backend configuration.
[backend]
# Backend type.
type="semtech_udp"

  # Semtech UDP packet-forwarder backend.
  [backend.semtech_udp]

  # ip:port to bind the UDP listener to
  #
  # Example: 0.0.0.0:1700 to listen on port 1700 for all network interfaces.
  # This is the listeren to which the packet-forwarder forwards its data
  # so make sure the 'serv_port_up' and 'serv_port_down' from your
  # packet-forwarder matches this port.
  udp_bind = "127.0.0.1:1700"

    # Managed packet-forwarder configuration.
    #
    # By configuring one or multiple managed packet-forwarder sections, the
    # ChirpStack Gateway Bridge updates the configuration when the backend receives
    # a configuration change, after which it will restart the packet-forwarder.
    #
    # Example (this configuration can be repeated):
    
    # [[backend.semtech_udp.configuration]]
    # # Gateway ID.
    # #
    # # The ChirpStack Gateway Bridge will only apply the configuration updates for this
    # # gateway ID.
    # gateway_id="AA555A0000000000"
    # 
    # # Base configuration file.
    # #
    # # This file will be used as base-configuration and will not be overwritten on
    # # a configuration update. This file needs to exist and contains the base
    # # configuration and vendor specific
    # base_file="/etc/opt/udp-packet-forwarder/gateway/chirpstack-gateway-bridge/gateway_global_conf.json"
    # 
    # # Output configuration file.
    # #
    # # This will be the final configuration for the packet-forwarder, containing
    # # a merged version of the base configuration + the requested configuration
    # # update.
    # # Warning: this file will be overwritten on a configuration update!
    # output_file="/etc/opt/udp-packet-forwarder/gateway/chirpstack-gateway-bridge/gateway_local_conf.json"
    # 
    # # Restart command.
    # #
    # # This command is issued by the ChirpStack Gateway Bridge on a configuration
    # # change. Make sure the ChirpStack Gateway Bridge process has sufficient
    # # permissions to execute this command.
    # restart_command="/usr/sbin/pmcli services chirpstack-gateway-bridge-udp udp-packet-forwarder restart"

# Integration configuration.
[integration]
# Payload marshaler.
#
# This defines how the MQTT payloads are encoded. Valid options are:
# * protobuf:  Protobuf encoding (this will become the ChirpStack Gateway Bridge v3 default)
# * json:      JSON encoding (easier for debugging, but less compact than 'protobuf')
marshaler="protobuf"

  # MQTT integration configuration.
  [integration.mqtt]
  # Event topic template.
  event_topic_template="gateway/{{ .GatewayID }}/event/{{ .EventType }}"

  # Command topic template.
  command_topic_template="gateway/{{ .GatewayID }}/command/#"

  # MQTT authentication.
  [integration.mqtt.auth]
  # Type defines the MQTT authentication type to use.
  #
  # Set this to the name of one of the sections below.
  type="generic"

    # Generic MQTT authentication.
    [integration.mqtt.auth.generic]
    # MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
    server="tcp://chirpstack.wifx.net:1883" # This server does not exist, it's juste an example

    # Connect with the given username (optional)
    username="lorix-one-78b7a5"

    # Connect with the given password (optional)
    password="bcuSk2fSte9acA0Q"
CODE

For advanced configuration, please refer to the the ChirpStack documentation.

The bridge configuration is stored in the /etc/opt/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml file. You can edit the file with:

sudo nano /etc/opt/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml
BASH

Configure the back-end

Use the edit button on the right in the "Backend configuration" section.

You can update the Gateway ID if needed, but by default it's already specific to each gateway.

For advanced configuration, please refer to the the UDP Packet Forwarder documentation.

The back-end configuration is stored in the /etc/opt/udp-packet-forwarder/gateway/chirpstack-gateway-bridge folder.

As for the UDP Packet Forwarder, the configuration is the merge of two files :

  • gateway_global_conf.json
  • gateway_local_conf.json

You can edit the file with:

sudo nano /etc/opt/udp-packet-forwarder/gateway/chirpstack-gateway-bridge/gateway_global_conf.json
or
sudo nano /etc/opt/udp-packet-forwarder/gateway/chirpstack-gateway-bridge/gateway_local_conf.json
BASH

Start the bridge

Press the Start button

You can Start the forwarder using the manager with :

sudo manager lora forwarder chirpstack-gateway-bridge start
BASH
ChirpStack Gateway Bridge forwarder has been started

The bridge will connect to the server and you will start seeing the LoRa traffic in the ChirpStack dashboard.