5 Using an External NS Server

5.1 Configuring the LoRa Gateway to Connect to an External NS

The gateway supports multiple LoRa protocols and forwarding modes, allowing flexible integration with various network servers and IoT platforms. The following sections describe each configuration method.

5.1.1 Using UDP (GWMP)

UDP GWMP (Gateway Message Protocol) is the standard protocol defined by Semtech, widely used to connect TTN, ChirpStack, and other open-source network servers.

Application Scenarios: Connecting to The Things Network (TTN), self-hosted ChirpStack servers, and similar platforms.

5.1.1.1 Connecting to Self-hosted ChirpStack via UDP

If ChirpStack is already installed, skip the installation steps below.

5.1.1.1.1 Installing ChirpStack on Ubuntu 24 — Example: chirpstack-v4.17.0
sudo apt update
sudo apt install  mosquitto mosquitto-clients redis-server redis-tools postgresql

configuration PostgreSQL

sudo -u postgres psql

Create the ChirpStack database

sudo -u postgres psql
-- create role for authentication
create role chirpstack with login password 'chirpstack';

-- create database
create database chirpstack with owner chirpstack;

-- change to chirpstack database
\c chirpstack

-- create pg_trgm extension
create extension pg_trgm;

-- exit psql
\q

Install the ChirpStack Gateway Bridge software

sudo apt install chirpstack-gateway-bridge

modifyChirpStack Gateway Bridge的configuration /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml

update[backend] 的configuration

[backend]
type="semtech_udp"
region="US915"
frequency_min=902000000
frequency_max=928000000

update[integration.mqtt] 的configuration

Example using US915; both device and gateway use A1B1 (channels 0–7 + 64), frequencies: 902.3–903.7

[integration.mqtt]
event_topic_template="us915_0/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
command_topic_template="us915_0/gateway/{{ .GatewayID }}/command/#"

Restart and enable ChirpStack Gateway Bridge

# restart chirpstack-gateway-bridge
sudo systemctl restart chirpstack-gateway-bridge

# start chirpstack-gateway-bridge on boot
sudo systemctl enable chirpstack-gateway-bridge
5.1.1.1.2 Adding the Gateway ID to the ChirpStack Platform
Note
- Example public server IP: 62.234.52.46
- ChirpStack default login: username admin, password admin
  1. In the gateway Web UI: NetworkLoRa GWConfiguration, copy the Gateway ID: 0010502df45635f8

Copy-Gateway-ID

  1. Log in to the installed ChirpStack platform and add the gateway on the gateway management page

Add-Gateway-to-ChirpStack1

  • Paste the copied gateway ID: 0010502df45635f8
  • Fill in Name: 0010502df45635f8
  • Fill in Gateway ID (EUI64): 0010502df45635f8

Add-Gateway-to-ChirpStack2

  • click "Submit"
  1. In the gateway interface NetworkLoRa GWConfiguration, configure as follows (example ChirpStack platform IP: 62.234.52.46):
  • Mode:Normal Mode
  • LoRaWAN® regions(LoRaWAN® band):US902-928
  • Gateway and server communication protocol (gateway-to-server communication protocol):UDP
  • server address (server address):62.234.52.46
  • Uplink port(UDP)(uplinkPort(UDP)):1700
  • Downstream port(UDP)(downlinkPort(UDP)):1700

Add-Gateway-to-ChirpStack3

  1. Click Save & Apply in the lower-right corner of the page
  1. On the gateway: NetworkLoRa GWStatus — view the gateway-to-server connection status. (Because PUSH packets are sent every 30 s, click Save & Apply and wait 1 minute before viewing ): check online status
  • gateway (PUSH) ↔ server (PUSH_ACK)
  • gateway (PULL) ↔ server (PULL_ACK)
  • Check whether ACK is present, which confirms connectivity to the server. You can also see the current UDP round-trip latency. Latency above 150 ms may affect downlink delivery success rates.

Add-Gateway-to-ChirpStack4

  1. On the platform side, view the gateway connection status

Gateway is now online, displayed as a US915-band gateway

Add-Gateway-to-ChirpStack5

5.1.1.2 Connecting to TTN via UDP
Note
- The example requires a pre-registered TTN account
- The examples use a single-band gateway; other band configurations follow the same procedure

Steps

  1. Log in to the gateway interface. Navigate to NetworkLoRa GWConfiguration. To configure the second LoRa module (16-channel version), go to Network16-channel expansion

LoRa-Gateway-Page

For the 16-channel version, you also need to configure the second LoRa page: 16-channel expansion

LoRa-16-Channel-Expansion-Page

  1. Navigate to LoRa GW (LoRa gateway)Configuration

LoRaconfigurePage

  1. Switch to the required LoRaWAN band

Switching bands does not change the gateway's default EUI. If the Configuration page parameters were incorrectly set, you can switch to another band and back to re-initialize the band parameters.

  • The 470 version only supports CN470; the 470 hardware does not require band switching
  • The 868 hardware version supports switching between EU868, RU864, and IN865
  • 915 version supports US902-928, AU915-928, AS923-1, AS923-2, AS923-3, AS923-4, KR920
  • For instructions on switching bands, refer to:
  1. Example: connecting to TTN (console.cloud.thethings.network) — you must register an account on the platform

LoginTTN

Find "Register gateway" on the TTN platform

Find-Register-Gateway-Button

The TTN platform shows the gateway ID input field

inputGateway

In another browser window, log in to the gateway page, find the LoRa gateway ID, and copy it

copyGatewayID

Paste the gateway ID on the TTN platform and click "Confirm" pasteGatewayID

On the TTN platform, paste the copied Gateway ID into "Gateway ID" and "Gateway name", select the "frequency plan", fill in the details, then click "Register gateway" Fill-in-Gateway-ID

Once registered on the TTN platform, enter the server address in the gateway settings

Register-to-TTN-Platform

Note
- Before configuring the UDP server address, confirm the domain assigned by TTN. The example TTN domain prefix for this gateway is: au1

Therefore, in the gateway settings, select the UDP protocol and set the server to the TTN au1 domain node

ttnPlatform

  • Mode:Normal Mode
  • Gateway and server communication protocol (gateway-to-server communication protocol):UDP
  • Server address: Target NS domain name or IP address (e.g., au1.cloud.thethings.network)
  • Uplink port(UDP)(uplinkPort(UDP)):1700
  • Downstream port(UDP)(downlinkPort(UDP)):1700

Configure the gateway to connect to TTN via UDP

Gateway configured with TTN platform domain

Click Save & Apply in the lower-right corner of the page

Gateway-Config-Click-Save-Apply

Wait 30–60 seconds, then check the gateway status on the TTN platform — it should show as online

Gateway online on TTN platform

5.1.2 Using MQTT-GWMP

The MQTT protocol is suitable for scenarios requiring a more flexible messaging mechanism. It supports connection to Winext's IoT Vision public cloud and private deployments of IoT Vision.

Application Scenarios: IoT Vision public cloud, IoT Vision private deployment.

5.1.2.1 Connecting to IoT Vision Cloud via MQTT GWMP
  • Using a CN470-band gateway as an example
  1. After logging in with your account, find Gateway Management in the menu and click Add Gateway

Adding gateway to IoT Vision platform 1


  1. Enter the gateway information; the authorization code must be obtained by contacting technical support

Adding gateway to IoT Vision platform 2


  1. Log in to the gateway interface: NetworkLoRa GWConfiguration
  • Mode: Normal Mode
  • Gateway and server communication protocol (gateway-to-server communication protocol):MQTT(GWMP)
  • External NS MQTT Server: Target NS domain name or IP address (e.g., 39.108.64.113)
  • External NS MQTT port (External NS MQTT Server Port):1879
  • External NS MQTT Username(NS MQTT Username):wangw
  • External NS MQTT password (External NS MQTT password):ww1030

Adding gateway to IoT Vision platform 3


  1. Click Save & Apply in the lower-right corner of the page
  1. On the gateway side: NetworkLoRa GWStatus — view the gateway\'s online connection status on the platform

Adding gateway to IoT Vision platform 4


  1. Refresh the platform page to view the gateway online status

Adding gateway to IoT Vision platform 5


5.1.2.2 Connecting to Self-deployed IoT Vision via MQTT GWMP

Refer to the public cloud connection steps:


5.1.3 Using ChirpStack MQTT Forwarder

chirpstack-mqtt-forwarder is the MQTT forwarding protocol provided by the ChirpStack open-source project; it uses Protobuf encoding for higher efficiency.

Application Scenario: Connecting to ChirpStack V4.x network server.

5.1.3.1 Connecting to Self-hosted ChirpStack via ChirpStack MQTT Forwarder

Steps

  1. In the gateway Web UI, navigate to NetworkLoRa GWConfiguration
  1. configuration MQTT connectparameters:
  • Gateway and server communication protocol (gateway-to-server communication protocol):MQTT(chirpstack-mqtt-forwarder)
  • chirpstack-mqtt-forwarder MQTT Server: Target NS domain name or IP address (e.g., 62.234.52.46)
  • chirpstack-mqtt-forwarder MQTT port (chirpstack-mqtt-forwarder MQTT Server Port):1883 8883
  • chirpstack-mqtt-forwarder MQTT Username: Enter the username configured in your MQTT Broker (Mosquitto, EMQX, etc.)
  • chirpstack-mqtt-forwarder MQTT password: Enter the password configured in your MQTT Broker (Mosquitto, EMQX, etc.)
  • Modify the topic prefix of chirpstack MQTT: Change the topic prefix for your deployment; defaults to the band value: cn470/eu868/ru864/in865/us915/au915/as923_1/as923_2/as923_3/as923_4/kr920
  • Use JSON: Check this to use JSON encoding; leave unchecked to use Protobuf (recommended)

In the deployed ChirpStack configuration file /etc/chirpstack/chirpstack.toml, find the enabled_regions setting

[network]
  enabled_regions = [
    "as923",
    "as923_2",
    "as923_3",
    "as923_4",
    "au915_0",
    "cn470_10",
    "cn779",
    "eu433",
    "eu868",
    "in865",
    "ism2400",
    "kr920",
    "ru864",
    "us915_0",
    "us915_1",
  ]

Example using US915; both device and gateway use A1B1 (channels 0–7 + 64), frequencies: 902.3–903.7,

Then I need to change the chirpstack MQTT topic prefix to: us915_0

  • Modify the topic prefix of chirpstack MQTT: Use a custom
  • Topic prefix(MQTT topic):us915_0

chirpstack-mqtt-forwarderconnectchirpstackconfigure

  1. Click Save & Apply in the lower-right corner of the page
  1. On the gateway side: NetworkLoRa GWStatus — view the gateway\'s online connection status on the platform

chirpstack-mqtt-forwarder-connect-chirpstack-status1

  1. On the ChirpStack platform page, view the gateway online status

chirpstack-mqtt-forwarder-connect-chirpstack-status2


5.1.4 Using Basic Station CUPS

CUPS (Configuration and Update Server) protocol is used to automatically retrieve the LNS configuration and certificate, commonly used with AWS IoT Core.

Application Scenario: AWS IoT Core for LoRaWAN.

5.1.4.1 Connecting to AWS IoT Core Using Basic Station CUPS
Note
- You must register an account on the AWS platform in advance
- Using the us-west-2 region as an example: https://us-west-2.console.aws.amazon.com/iot/home?region=us-west-2#/wireless/gateways
- After account registration, because the gateway connects to AWS IoT Core using CUPS certificates, refer to the AWS IoT documentation to add the required IAM role permissions.
- IoTWirelessGatewayCertManagerRole can be viewed at https://us-east-1.console.aws.amazon.com/iam/home?region=us-east-1&redirectFrom=iamv2#/roles
- AWSIoTWirelessGatewayCertManager
- Connecting the gateway to AWS incurs data charges; a credit card must be linked to your AWS account.

Steps

  1. In the gateway Web UI, navigate to NetworkLoRa GWConfiguration and copy the Gateway ID. Example: 0010502df45635f8
  2. Add the gateway on the AWS IoT console: https://us-west-2.console.aws.amazon.com/iot/home?region=us-west-2#/wireless/gateways

cupsconnectawsconfigure1

  • pastegatewayID
  • Select band, example: US915
  • Click the Add gateway button in the lower-right corner

cupsconnectawsconfigure2

  1. Create the gateway CUPS access certificate, copy the CUPS endpoint URL to the gateway page, then click to download the certificate

cupsconnectawsconfigure3

cupsconnectawsconfigure4

  1. In Gateway permissions, select AWSIoTWirelessGatewayCertManager, then submit

cupsconnectawsconfigure5

  1. Return to the gateway Web UI: NetworkLoRa GWConfiguration, and configure the following settings:
  • Gateway and server communication protocol (gateway-to-server communication protocol):CUPS(Basic Station)
  • CUPS: HTTPS address (e.g., https://<account-id>.cups.lorawan.amazonaws.com:443)
  • CUPS CA certificate 'cups.trust': Open the cups.trust file, copy the certificate content and paste it into the text field
  • CUPS client certificate "cups.crt": Open the xxx.cert.pem file, copy the certificate content and paste it into the text field
  • CUPS client private key "cups.key": Open the xxx.private.key file, copy the key content and paste it into the text field

cupsconnectawsconfigure6


  1. Click Save & Apply in the lower-right corner of the page
  2. The gateway will automatically fetch the LNS configuration from the CUPS server; view the corresponding communication log to verify

cupsconnectawsconfigure7


cupsconnectawsconfigure8

  1. On the gateway side: NetworkLoRa GWStatus — view the gateway\'s online connection status on the platform

cupsconnectawsconfigure9

  1. On the AWS IoT platform page, verify the gateway online status

cupsconnectawsconfigure10


5.1.5 Using Basic Station LNS

The LNS (LoRaWAN Network Server) protocol is WebSocket-based and supports connecting to TTN, ChirpStack, Microsoft Azure IoT, and other platforms.

Application Scenario: ChirpStack, TTN, Microsoft Azure IoT Central.

5.1.5.1 Connecting to TTN via Basic Station LNS
Note
- A pre-registered TTN platform account is required
- Using the au1 region as an example: https://au1.cloud.thethings.network/console/gateways
  1. In the gateway Web UI, navigate to NetworkLoRa GWConfiguration and copy the Gateway ID. Example: 0010502df45635f8
  1. Add the gateway on the TTN platform

lnsconnectttnconfigure1

  • gateway EUipaste0010502df45635f8,clickConfirm
  • Next
  • gateway IDpaste0010502df45635f8
  • gateway namepaste0010502df45635f8
  • Frequency planselectUnited States 902-928MHz,FSB1
  • Check Require authenticated connection
  • Check Generate API key for LNS

lnsconnectttnconfigure2

  1. Click Register gateway at the bottom of the page
  1. In the dialog box, click to download the certificate

lnsconnectttnconfigure3

  1. Return to the gateway Web UI: NetworkLoRa GWConfiguration, and configure the following settings:
  • Gateway and server communication protocol (gateway-to-server communication protocol):LNS(Basic Station)
  • LNS: WebSocket address (e.g., wss://au1.cloud.thethings.network:8887)
  • LNS CA certificate 'tc.trust': Download from https://www.thethingsindustries.com/docs/concepts/advanced/root-certificates/
  • LNS client certificate 'tc.crt': Leave blank — TTN does not require this field
  • LNS client private key "tc.key": Open the downloaded tc.key file, copy the certificate content and paste it into the text field

lnsconnectttnconfigure4


lnsconnectttnconfigure5


  1. Click Save & Apply in the lower-right corner of the page
  1. Gateway-to-server WSS communication log, as follows

lnsconnectttnconfigure6


lnsconnectttnconfigure7


  1. On the gateway side: NetworkLoRa GWStatus — view the gateway\'s online connection status on the platform

lnsconnectttnconfigure8

  1. On the TTN platform page, view the gateway online status

lnsconnectttnconfigure9


5.1.5.2 Connecting to ChirpStack via Basic Station LNS
Note
- Consult the ChirpStack documentation to set up a domain name and TLS certificate beforehand. LNS connections require a domain name — IP addresses are not supported.
- Using the built-in ChirpStack 4.17.0 as an example
- If you are unfamiliar with deploying ChirpStack in LNS mode, it is recommended to use UDP or MQTT mode, or consult additional documentation.
- Example gateway ID: 0010502df45635f8
  1. In the ChirpStack UI, add the Gateway ID: 0010502df45635f8. Under TLS certificate, click Generate certificate to generate the LNS certificate

lnsconnectchirpstackconfigure1


lnsconnectchirpstackconfigure2

  1. Return to the gateway Web UI: NetworkLoRa GWConfiguration, and configure the following settings:
  • Gateway and server communication protocol (gateway-to-server communication protocol):LNS(Basic Station)
  • LNS: WebSocket address (e.g., wss://gateway.lan:3001)
  • LNS CA certificate 'tc.trust': The CA certificate generated in step 1 on the ChirpStack page
  • LNS client certificate 'tc.crt': The TLS certificate generated in step 1 on the chirpstack page
  • LNS client private key 'tc.key': The TLS private key generated in step 1 on the chirpstack page

lnsconnectchirpstackconfigure3

  1. Click Save & Apply in the lower-right corner of the page
  1. On the gateway side: NetworkLoRa GWStatus — view the gateway\'s online connection status on the platform

lnsconnectchirpstackconfigure4

  1. On the ChirpStack platform page, view the gateway online status

lnsconnectchirpstackconfigure5

View ChirpStack communication log

lnsconnectchirpstackconfigure6

5.2 16-Channel Gateway Frequency Band and Channels

On the gateway Web page: Network16-channel expansionConfiguration


5.2.1 16-Channel Gateway CN470 Frequency Configuration

On the gateway Web page: Network16-channel expansionConfiguration


5.2.2 16-Channel Gateway 868 Band Switching

On the gateway Web page: Network16-channel expansionConfiguration


5.2.3 16-Channel Gateway 915 Band Switching

On the gateway Web page: Network16-channel expansionConfiguration


5.3 16-Channel Gateway Connecting to External NS

The gateway supports multiple LoRa protocols and forwarding modes, allowing flexible integration with various network servers and IoT platforms. The following sections describe each configuration method.

5.3.1 16-Channel Gateway Using UDP

UDP GWMP (Gateway Message Protocol) is the standard protocol defined by Semtech, widely used to connect TTN, ChirpStack, and other open-source network servers.

Application Scenarios: Connecting to The Things Network (TTN), self-hosted ChirpStack servers, and similar platforms.

5.3.1.1 Configuring the 16-Channel Gateway to Connect to ChirpStack via UDP

On the gateway Web page: Network16-channel expansionConfiguration


5.3.1.2 Configuring the 16-Channel Gateway to Connect to TTN via UDP

On the gateway Web page: Network16-channel expansionConfiguration


5.3.2 16-Channel Gateway Using MQTT-GWMP

The MQTT protocol is suitable for scenarios requiring a more flexible messaging mechanism. It supports connection to Winext's IoT Vision public cloud and private deployments of IoT Vision.

Application Scenarios: IoT Vision public cloud, IoT Vision private deployment.

5.3.2.1 Configuring the 16-Channel Gateway to Connect to Public Cloud IoT via MQTT-GWMP

On the gateway Web page: Network16-channel expansionConfiguration


5.3.2.2 Configuring the 16-Channel Gateway to Connect to Private IoT via MQTT-GWMP

On the gateway Web page: Network16-channel expansionConfiguration


5.3.3 16-Channel Gateway Using ChirpStack MQTT Forwarder

On the gateway Web page: Network16-channel expansionConfiguration


5.3.4 16-Channel Gateway Using Basic Station CUPS

CUPS (Configuration and Update Server) protocol is used to automatically retrieve the LNS configuration and certificate, commonly used with AWS IoT Core.

Application Scenario: AWS IoT Core for LoRaWAN.

5.3.4.1 Configure 16-Channel Gateway to Connect to AWS Using Basic Station CUPS

On the gateway Web page: Network16-channel expansionConfiguration


5.3.5 16-Channel Gateway Using Basic Station LNS

The LNS (LoRaWAN Network Server) protocol is WebSocket-based and supports connecting to ChirpStack, TTN, Microsoft Azure IoT, and other platforms.

Application Scenario: ChirpStack, TTN, Microsoft Azure IoT Central.

5.3.5.1 Configuring the 16-Channel Gateway to Connect to TTN via Basic Station LNS

On the gateway Web page: Network16-channel expansionConfiguration


5.3.5.2 Configuring the 16-Channel Gateway to Connect to ChirpStack via Basic Station LNS

On the gateway Web page: Network16-channel expansionConfiguration