A data flow diagram illustrating how a LoRaWAN gateway sends UDP packets to ChirpStack, which converts them to MQTT for visualization dashboards.

Build a Private Network: LoRaWAN Gateway & ChirpStack

Written by: Robert Liao

|

Published on

|

Time to read 5 min

Author: Robert Liao, Technical Support Engineer

Robert Liao is an IoT Technical Support Engineer at Robustel with hands-on experience in industrial networking and edge connectivity. Certified as a Networking Engineer, he specializes in helping customers deploy, configure, and troubleshoot IIoT solutions in real-world environments. In addition to delivering expert training and support, Robert provides tailored solutions based on customer needs—ensuring reliable, scalable, and efficient system performance across a wide range of industrial applications.

Summary

Public networks are great for testing, but enterprises often demand data sovereignty. Building a private LoRaWAN network allows you to own the entire stack—from the sensor to the LoRaWAN gateway to the Network Server. This guide explains how to use ChirpStack, the industry-standard open-source Network Server, to manage your fleet. We provide a technical roadmap for deploying ChirpStack via Docker and configuring an industrial LoRaWAN gateway to forward packets to your private IP address, eliminating monthly fees and cloud dependencies.

Key Takeaways

Why Private? You keep 100% of the data. No third-party cloud provider sees your sensor payloads. Ideally suited for GDPR-sensitive industries or secure facilities.

The Architecture: Your LoRaWAN gateway acts as a "dumb pipe," forwarding encrypted packets to your ChirpStack server (hosted on-premise or AWS/Azure).

The Bridge: The "ChirpStack Gateway Bridge" software converts UDP packets from the LoRaWAN gateway into MQTT messages for the server.

Cost Control: Once you buy the LoRaWAN gateway, the ongoing software cost is zero (if self-hosted). You escape the "per-sensor" subscription model.

Build a Private Network: LoRaWAN Gateway & ChirpStack

For many businesses, the idea of sending proprietary sensor data through a public network (like TTN) is a non-starter. Whether due to security regulations, privacy concerns, or simple cost avoidance, the solution is a Private Network.

To build one, you need two things:

  1. Hardware: An industrial LoRaWAN gateway.
  2. Software: A Network Server (LNS).

ChirpStack is the world's most popular open-source LNS. It gives you the power of a telecom operator on your own server.

This guide walks you through the architecture and configuration required to connect your Robustel LoRaWAN gateway to a private ChirpStack instance.


A comparison diagram showing the difference between a public cloud LoRaWAN architecture and a private on-premise network using ChirpStack.


The Architecture: How It Works

In a private setup, the LoRaWAN gateway does not talk to the internet at large. It talks only to your server.

  1. The Sensor: Sends an encrypted radio packet.
  2. The LoRaWAN gateway: Receives the packet via its antenna. It wraps the packet in UDP or Basic Station protocol and sends it to your server's IP address.
  3. The ChirpStack Gateway Bridge: This software (running on your server or the gateway) translates the packet into MQTT.
  4. The ChirpStack Network Server: De-duplicates the packet, decrypts it using the NwkSKey, and forwards the data to your application.

Step 1: Deploying ChirpStack

You don't need a supercomputer. You can run ChirpStack on a cheap cloud VPS (DigitalOcean/AWS) or even a local Raspberry Pi for testing.

The easiest method is using Docker Compose.

  • Download the official ChirpStack Docker repository.
  • Run docker-compose up -d.
  • This spins up the Network Server, Application Server, PostgreSQL (database), and Redis (cache) containers automatically.
  • Access the web interface at http://YOUR-SERVER-IP:8080. Default login is admin / admin.

Step 2: Configuring the LoRaWAN Gateway

Now you must point your hardware to your new server. Log into your Robustel LoRaWAN gateway web interface (RobustOS).

Option A: Semtech UDP (Easiest)

  1. Go to LoRaWAN > Packet Forwarder.
  2. Select Protocol:Semtech UDP.
  3. Server Address: Enter the IP address of your ChirpStack server.
  4. Port: Default is 1700.
  5. Gateway EUI: Copy this string (e.g., 00A0C5...). You will need it for Step 3.
  6. Click Apply.

Option B: Basic Station (Most Secure) If your LoRaWAN gateway supports it, use Basic Station. It uses TCP/SSL instead of UDP, making it more reliable over cellular connections. You will need to copy the LNS certificate from your ChirpStack server to the gateway.


A configuration visual showing how to point a Robustel LoRaWAN gateway to a private IP address using the Semtech UDP Packet Forwarder.


Step 3: Registering the LoRaWAN Gateway in ChirpStack

Your server is running, and your gateway is pointing to it. Now you must introduce them.

  1. Log into the ChirpStack UI.
  2. Navigate to Gateways > Create.
  3. Gateway ID: Paste the LoRaWAN gateway EUI you copied earlier.
  4. Name: Give it a friendly name (e.g., Warehouse-Gateway-1).
  5. Stats Interval: Set to 30 seconds.
  6. Click Submit.

If everything is correct, the "Last Seen" timestamp will turn green "A few seconds ago." Your LoRaWAN gateway is now effectively a private telecom tower under your control.

Step 4: Adding Sensors and Decoding Data

With the LoRaWAN gateway connected, you can now add Device Profiles and Applications. ChirpStack includes built-in JavaScript decoders.

  • When a sensor sends a hex payload (e.g., 0167), the server uses your script to convert it into JSON (e.g., {"temperature": 25.5}).
  • From there, you can use the Integrations tab to push this JSON to your own database (InfluxDB), dashboard (Grafana), or IoT platform (ThingsBoard) via MQTT or HTTP Webhooks.

A data flow diagram illustrating how a LoRaWAN gateway sends UDP packets to ChirpStack, which converts them to MQTT for visualization dashboards.


Conclusion: Data Sovereignty

Building a private network requires a bit more IT work upfront, but the long-term rewards are massive.

By pairing a rugged Robustel LoRaWAN gateway with ChirpStack, you eliminate monthly fees and third-party data risks. You create a closed-loop system where you own the hardware, the software, and most importantly, the data. For enterprise IoT, this is the gold standard of architecture.

Frequently Asked Questions (FAQ)

Q1: Can I run ChirpStack directly on the LoRaWAN gateway?

A1: Yes! This is called "Embedded LNS." Powerful industrial gateways (like the Robustel R3000 LG) have enough CPU and RAM to run a lightweight version of ChirpStack (formerly LoRa Server) directly on the device. This allows the LoRaWAN gateway to process data locally and send decoded JSON to your cloud, saving bandwidth.

Q2: Is UDP reliable for the LoRaWAN gateway connection?

A2: UDP is "fire and forget." It is fast but does not guarantee delivery. If your LoRaWAN gateway is on a shaky 4G connection, you might lose packets. We highly recommend using the Basic Station protocol if possible, as it uses TCP (WebSockets), which guarantees packet delivery and is more resilient to network jitter.

Q3: How many gateways can one ChirpStack server handle?

A3: ChirpStack is highly scalable. A single properly configured server can handle hundreds of LoRaWAN gateway connections and tens of thousands of sensors. Since the gateway does the heavy lifting of radio demodulation, the server's job is mostly database management and deduplication, which is computationally efficient.