Chirpstack to BasicStation connectivity

Hi all,

I’m trying to setup a Chirpstack LNS and BasicStation gateway and both of these components are running in NXP i.MX boards. I am facing a connection refused error from BasicStation even if I put the correct IP address and port numbers:

[Note: There will be extra comments from the normal BasicStation logs, as I have included them to root cause the problem]
Here is my gateway-bridge configuration:

# See https://www.chirpstack.io/gateway-bridge/install/config/ for a full
# configuration example and documentation.

[integration.mqtt.auth.generic]
servers=["tcp://mosquitto:1883"]
username=""
password=""

[integration.mqtt]
#event_topic_template="ism2400/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
#state_topic_template="ism2400/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
#command_topic_template="ism2400/gateway/{{ .GatewayID }}/command/#"
event_topic_template="eu868/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
state_topic_template="eu868/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
command_topic_template="eu868/gateway/{{ .GatewayID }}/command/#"
#event_topic_template="us915_0/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
#state_topic_template="us915_0/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
#command_topic_template="us915_0/gateway/{{ .GatewayID }}/command/#"
#event_topic_template="us915_1/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
#state_topic_template="us915_1/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
#command_topic_template="us915_1/gateway/{{ .GatewayID }}/command/#"
#event_topic_template="us915_2/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
#state_topic_template="us915_2/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
#command_topic_template="us915_2/gateway/{{ .GatewayID }}/command/#"
#event_topic_template="us915_3/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
#state_topic_template="us915_3/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
#command_topic_template="us915_3/gateway/{{ .GatewayID }}/command/#"
#event_topic_template="us915_4/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
#state_topic_template="us915_4/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
#command_topic_template="us915_4/gateway/{{ .GatewayID }}/command/#"
#event_topic_template="us915_5/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
#state_topic_template="us915_5/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
#command_topic_template="us915_5/gateway/{{ .GatewayID }}/command/#"
#event_topic_template="us915_6/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
#state_topic_template="us915_6/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
#command_topic_template="us915_6/gateway/{{ .GatewayID }}/command/#"
#event_topic_template="us915_7/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
#state_topic_template="us915_7/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
#command_topic_template="us915_7/gateway/{{ .GatewayID }}/command/#"

# Gateway backend configuration.
[backend]
#type="basic_station"
  # Basic Station backend.
  [backend.basic_station]

  # ip:port to bind the Websocket listener to.
  bind=":3001"

  # TLS certificate and key files.
  #
  # When set, the websocket listener will use TLS to secure the connections
  # between the gateways and ChirpStack Gateway Bridge (optional).
  tls_cert=""
  tls_key=""

  # TLS CA certificate.
  #
  # When configured, ChirpStack Gateway Bridge will validate that the client
  # certificate of the gateway has been signed by this CA certificate.
  ca_cert=""

  # Stats interval.
  #
  # This defines the interval in which the ChirpStack Gateway Bridge forwards
  # the uplink / downlink statistics.
  stats_interval="30s"

  # Ping interval.
  ping_interval="1m0s"

  # Timesync interval.
  #
  # This defines the interval in which the ChirpStack Gateway Bridge sends
  # a timesync request to the gateway. Setting this to 0 disables sending
  # timesync requests.
  timesync_interval="1h0m0s"

  # Read timeout.
  #
  # This interval must be greater than the configured ping interval.
  read_timeout="1m5s"

  # Write timeout.
  write_timeout="1s"

  # Region.
  #

  # Please refer to the LoRaWAN Regional Parameters specification
  # for the complete list of common region names.
  region="EU868"

  # Minimal frequency (Hz).
  frequency_min=863000000

  # Maximum frequency (Hz).
  frequency_max=870000000

  # Concentrator configuration.
  #
  # This section contains the configuration for the SX1301 concentrator chips.
  # Example:
  # [[backend.basic_station.concentrators]]
  #
  #   # Multi-SF channel configuration.
  #   [backend.basic_station.concentrators.multi_sf]
  #
  #   # Frequencies (Hz).
  #   frequencies=[
  #     868100000,
  #     868300000,
  #     868500000,
  #     867100000,
  #     867300000,
  #     867500000,
  #     867700000,
  #     867900000,
  #   ]
  #
  #   # LoRa STD channel.
  #   [backend.basic_station.concentrators.lora_std]
  #
  #   # Frequency (Hz).
  #   frequency=868300000
  #
  #   # Bandwidth (Hz).
  #   bandwidth=250000
  #
  #   # Spreading factor.
  #   spreading_factor=7
  #
  #   # FSK channel.
  #   [backend.basic_station.concentrators.fsk]
  #
  #   # Frequency (Hz).
  #   frequency=868800000

Can anyone please point me where I’m going wrong or how to resolve the connection refused error?[Note: I’m trying to connect without any security, so I’m not using any certificates.]

Please see: Configuration - ChirpStack open-source LoRaWAN® Network Server documentation.

What you are missing in your config is:

# Gateway backend configuration.
[backend]

# Backend type.
#
# Valid options are:
#   * semtech_udp
#   * concentratord
#   * basic_station
type="basic_station"

Hi Brocaar,
Thanks for the quick reply
It’s a mistake from my end, I commented the type=“basic_station” while trying to connect with different servers for verification.
I tested with type=“basic_station” too in the configuration file, but still I’m unable to see any logs on the Chirpstack to say that it has tried to communicate. BasicStation also says the same connection failed.
Here is the start of the log to show that the ports have been configured:

Creating alpha-2-test_redis_1     ... done
Creating alpha-2-test_mosquitto_1 ... done
Creating alpha-2-test_postgres_1                  ... done
Creating alpha-2-test_chirpstack-gateway-bridge_1 ... done
Creating alpha-2-test_chirpstack_1                ... done
Creating alpha-2-test_chirpstack-rest-api_1       ... done
Attaching to alpha-2-test_redis_1, alpha-2-test_mosquitto_1, alpha-2-test_postgres_1, alpha-2-test_chirpstack-gateway-bridge_1, alpha-2-test_chirpstack_1, alpha-2-test_chirpstack-rest-api_1
chirpstack-gateway-bridge_1  | time="2022-09-16T10:25:33.812262748Z" level=info msg="starting ChirpStack Gateway Bridge" docs="https://www.chirpstack.io/gateway-bridge/" version=
chirpstack-gateway-bridge_1  | time="2022-09-16T10:25:33.818416693Z" level=warning msg="[store]    memorystore wiped" module=mqtt
chirpstack-gateway-bridge_1  | time="2022-09-16T10:25:33.819041051Z" level=info msg="integration/mqtt: connected to mqtt broker"
chirpstack-gateway-bridge_1  | time="2022-09-16T10:25:33.819373118Z" level=info msg="backend/basicstation: starting websocket listener" bind="[::]:3001" ca_cert= tls_cert= tls_key=
chirpstack_1                 | Sep 16 10:25:33.893  INFO chirpstack::cmd::root: Starting ChirpStack LoRaWAN Network Server version="4.0.0-rc.2" docs="https://www.chirpstack.io/"
chirpstack_1                 | Sep 16 10:25:33.893  INFO chirpstack::region: Setting up regions
chirpstack_1                 | Sep 16 10:25:33.893  INFO setup{common_name=ISM2400 region_name=ism2400}: chirpstack::region: Configuring region
chirpstack_1                 | Sep 16 10:25:33.893  WARN setup{common_name=AU915 region_name=au915_5}: chirpstack::region: Config exists, but region is not enabled. To enable it, add it to 'network.enabled_regions'
chirpstack_1                 | Sep 16 10:25:33.893  INFO setup{common_name=US915 region_name=us915_5}: chirpstack::region: Configuring region
chirpstack_1                 | Sep 16 10:25:33.894  WARN setup{common_name=CN779 region_name=cn779}: chirpstack::region: Config exists, but region is not enabled. To enable it, add it to 'network.enabled_regions'
chirpstack_1                 | Sep 16 10:25:33.894  WARN setup{common_name=EU433 region_name=eu433}: chirpstack::region: Config exists, but region is not enabled. To enable it, add it to 'network.enabled_regions'
mosquitto_1                  | 1663323931: mosquitto version 2.0.15 starting
mosquitto_1                  | 1663323931: Config loaded from /mosquitto/config/mosquitto.conf.
mosquitto_1                  | 1663323931: Opening ipv4 listen socket on port 1883.
mosquitto_1                  | 1663323931: Opening ipv6 listen socket on port 1883.
mosquitto_1                  | 1663323931: mosquitto version 2.0.15 running
mosquitto_1                  | 1663323933: New connection from 172.21.0.5:43766 on port 1883.
postgres_1                   | 

Also I tried wireshark to capture any activity between the BasicStation and Chirpstack LNS:


[Note: IP address of the gateway running BasicStation is 192.168.1.69 and Chirpstack LNS IP address is 192.168.1.73]

Hi all,
I was able to resolve this issue by changing the docker yml file and including another image to run BasicStation seperately.
To whoever has connectivity issues with BasicStation using the latest v4 chirpstack docker containers, please modify your docker-compose.yml as such:

services:
  chirpstack:
    image: chirpstack/chirpstack:4.0.0-rc.2
    command: -c /etc/chirpstack
    restart: unless-stopped
    volumes:
      - ./configuration/chirpstack:/etc/chirpstack
      - ./lorawan-devices:/opt/lorawan-devices
    depends_on:
      - postgres
      - mosquitto
      - redis
    ports:
      - 8080:8080

  chirpstack-gateway-bridge-2g4:
    image: chirpstack/chirpstack-gateway-bridge:4.0.0-rc.1
    ports:
      - 1700:1700/udp
    volumes:
      - ./configuration/chirpstack-gateway-bridge-2g4:/etc/chirpstack-gateway-bridge
    depends_on:
      - mosquitto

  chirpstack-gateway-bridge-sub:
    image: chirpstack/chirpstack-gateway-bridge:4.0.0-rc.1
    ports:
      - 3001:3001/tcp
    volumes:
      - ./configuration/chirpstack-gateway-bridge-sub:/etc/chirpstack-gateway-bridge
    depends_on:
      - mosquitto

  chirpstack-rest-api:
    image: chirpstack/chirpstack-rest-api:4.0.0-rc.1
    command: --server chirpstack:8080 --bind 0.0.0.0:8090 --insecure
    ports:
      - 8090:8090
    depends_on:
      - chirpstack

Do note that I have different configuration files for both the 2.4GHz packet forwarder and Sub-GHz BasicStation gateway-bridge