Cisco

Cisco Wireless Gateway

Preparation

Before proceeding with the following steps, make sure you have connected the antennas and (PoE) ethernet interface as documented by the Cisco manual.

The following steps are executed using the Cisco Console interface, for which you need a special USB (connected to your computer) to RJ45 (connected to the gateway) console cable.

Note: the following instructions only reflect the configuration to get you started. Please consult the Cisco Wireless Gateway documentation for a complete manual.

Connect to console

You can use screen to connect to the Cisco (serial) Console. Example:

# replace /dev/ttyUSB with the serial device
screen /dev/ttyUSB0 115200

After the gateway has been fully started, you will see the folliwing line:

Press RETURN to get started

Press RETURN and you will see Gateway> as prompt. For the configuration of the Cisco, you need to turn on the Privileged commands. To do so, enter the following command:

enable

The prompt should now have changed to Gateway#.

Firmware version

Enter the following command to display the installed firmware version of the gateway:

show version

Make sure that the version is (at least) 2.0.32. If your gateway has an older version installed, please update it first.

Network setup

Enter the following commands to configure the Gateway network interface:

# Configure gateway from the terminal
configure terminal

# Select interface to configure
interface FastEthernet 0/1

To automatically assign an IP address using DHCP:

ip address dhcp

To assign a static IP address to the gateway:

ip address <ip-address> <subnet-mask>

To save the network interface configuration:

# Set interface specific description
description Ethernet

# Exit interface configuration
exit

# Exit configuration mode
exit

# Save the configuration
copy running-config startup-config

To test that the ethernet interface has been configured properly, you can use the ping ip command:

ping ip <ip-address>

Enable GPS

Enter the following commands to enable the GPS module:

# Configure gateway from the terminal
configure terminal

# Enable UBX data in UART output
gps ubx enable

# Exit configuration mode
exit

# Save the configuration
copy running-config startup-config

Packet Forwarder

The Cisco Wireless Gateway comes with an UDP Packet Forwarder for testing purposes. This Packet Forwarder is running in an isolated LXC container. To access the shell for this LXC container:

# Request lxc-container console access
request shell container-console

You will be requested to enter the System Password. By default this is admin.

Configuration

Create the directory to store the Packet Forwarder configuration:

mkdir /etc/lora-packet-forwarder

Cisco provides a list of configuration templates. To list the available templates:

ls -l /tools/templates

Copy the configuration template to /etc/lora-packet-forwarder:

cp /tools/templates/<template> /etc/lora-packet-forwarder/config.json

Next update the configuration file so that it forwards the UDP data to localhost on port 1700.

vi /etc/lora-packet-forwarder/config.json

Under gateway_conf update the following keys:

  • server_address: "localhost"
  • serv_port_up: 1700
  • serv_port_down: 1700

To test the Packet Forwarder, you can run the following command:

/tools/pkt_forwarder -c /etc/lora-packet-forwarder/config.json -g /dev/ttyS1

Init script

To start the Packet Forwarder automatically, you need to create an init script. To create this file:

vi /etc/init.d/S60lora-packet-forwarder

Then paste the following content:

#!/bin/sh

start() {
  echo "Starting lora-packet-forwarder"
  start-stop-daemon \
  	--start \
	--background \
	--make-pidfile \
	--pidfile /var/run/lora-packet-forwarder.pid \
	--exec /tools/pkt_forwarder -- -c /etc/lora-packet-forwarder/config.json -g /dev/ttyS1
}

stop() {
  echo "Stopping lora-packet-forwarder"
  start-stop-daemon \
  	--stop \
	--oknodo \
	--quiet \
	--pidfile /var/run/lora-packet-forwarder.pid
}

restart() {
  stop
  sleep 1
  start
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart|reload)
    restart
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
esac

exit $?

Then make the init script executable:

chmod +x /etc/init.d/S60lora-packet-forwarder

To start the Packet Forwarder manually:

/etc/init.d/S60lora-packet-forwarder start

The next time when the Wireless Gateway is (re)started, the Packet Forwarder will be started automatically.

LoRa Gateway Bridge

By installing the LoRa Gateway Bridge directly on the Wireless Gateway, it can be directly connected to a MQTT broker. When you have exited the LXC shell, enter it again:

# Request lxc-container console access
request shell container-console

Download

Copy the link to the latest LoRa Gateway Bridge armv7.tar.gz package from the Downloads page. Then:

# Create directories
mkdir -p /opt/lora-gateway-bridge

# Download LoRa Gateway Bridge
cd /opt/lora-gateway-bridge
wget <download-link>

# Uncompress archive
tar zxf *.tar.gz

# Remove archive file
rm *.tar.gz

Configuration

The LoRa Gateway Bridge uses a file for configuration. Please refer to Configuration for a full example. Below you will find a minimal configuration example to get you started.

To create the configuration directory and create the configuration file:

mkdir /etc/lora-gateway-bridge
vi /etc/lora-gateway-bridge/lora-gateway-bridge.toml

Then paste the following configuration and make modifications where needed:

# 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 = "0.0.0.0:1700"


# Integration configuration.
[integration]
# Payload marshaler.
#
# This defines how the MQTT payloads are encoded. Valid options are:
# * protobuf:  Protobuf encoding (this will become the LoRa 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://127.0.0.1:1883"

    # Connect with the given username (optional)
    username=""

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

To test the LoRa Gateway Bridge, you can run the following command:

/opt/lora-gateway-bridge/lora-gateway-bridge -c /etc/lora-gateway-bridge/lora-gateway-bridge.toml

Init script

To start the LoRa Gateway Bridge automatically, you need to create an init script. To create this file:

vi /etc/init.d/S60lora-gateway-bridge

Then paste the following content:

#!/bin/sh

start() {
  echo "Starting lora-gateway-bridge"
  start-stop-daemon \
  	--start \
	--background \
	--make-pidfile \
	--pidfile /var/run/lora-gateway-bridge.pid \
	--exec /opt/lora-gateway-bridge/lora-gateway-bridge -- -c /etc/lora-gateway-bridge/lora-gateway-bridge.toml
}

stop() {
  echo "Stopping lora-gateway-bridge"
  start-stop-daemon \
  	--stop \
	--oknodo \
	--quiet \
	--pidfile /var/run/lora-gateway-bridge.pid
}

restart() {
  stop
  sleep 1
  start
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart|reload)
    restart
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
esac

exit $?

Then make the init script executable:

chmod +x /etc/init.d/S60lora-gateway-bridge

To start the LoRa Gateway Bridge manually:

/etc/init.d/S60lora-gateway-bridge start

The next time when the Wireless Gateway is (re)started, the LoRa Gateway Bridge will be started automatically.