MikroTik LoRa Router setup

From Sensors in Schools
Jump to navigation Jump to search

Introduction

  • A LoRa (Long Range Radio) router is used to receive signals from sensors and relay them to the internet where the data packets are picked up by The Things Network (TTN).
  • The Things Network then makes the data available to any user if they subscribe to the data feed.
  • LoRa routers are very important for Internet of Things (IoT) devices because LoRa communication uses very litter power and can transit over long distances. Most Internet of Things devices only send small amounts of data. But that data is important (e.g. soil moisture in a field of wheat, temperature of water in a creek). IoT devices are generally connected to the internet.
  • In the future most devices will be connected to either the internet or to other devices. Using these devices intelligently will help us overcome some of the serious environmental challenges we face in the world.

Authors

For more information contact Adam Simankowicz or Edmond Lascaris

Background

  • The Raspbian Operating system was installed on an old laptop.
  • The old laptop was accessed from a Mac computer using Microsoft Remote Desktop.
  • TeamViewer can also be used to connect to a remote computer.

References

Creating a Backup of the Router Configuration

  • Click on Files
  • Then click on the Backup Button

  • In the Backup Window enter:
    • file name – no need for .backup extension. This will be added automatically
    • password
    • make sure file is encrypted

  • Once a backup is created it should show up in the file list.
  • Note that these files are still on the router, not on the host computer

  • To transfer the file to the host computer.
  • Right mouse button click on the file and select Download

  • Choose the directory to download the file.
  • The selection in this case is Desktop.
  • Make sure to check that the file has downloaded correctly.
  • Copy the file from the computer and store in a safe place to allow for future restoration of the config file.

Using winbox.exe on a Raspberry Pi computer to configure the MikroTik router

  • To start configuring the MikroTik router you need to download the 32bit version of the WinBox.exe file to a PC computer running Raspbian.
  • You cannot use this file on a Raspberry Pi computer because the underlying CPU architecture is different.
  • To run the exe file you will also need to install wine on the PC computer using the command sudo apt-get install wine

  • The WinBox.exe file will be downloaded to the Downloads file on the PC running Raspbian.
  • To run winbox.exe (32 bit version) enter the Terminal command wine winbox.exe

Installing XRDP on Raspbian

  • You can find detailed instructions for the installation of the XRDP Desktop on the following URL.
  • Xrdp is an open-source implementation of the Microsoft Remote Desktop Protocol (RDP) that allows you to graphically control a remote system.
  • Using Xrdp you can log in to a Raspberry Pi from another computer running Windows, macOS or Linux, and interact with the remote computer using a desktop session
  • The Raspberry Pi and the client machine have to be connected to the same network or the Internet.
  • To use Xrdp we need to install the Xrdp Server on the Raspberry P
  • To install Xrdp Server enter the command sudo apt-get install xrdp

https://linuxize.com/post/how-to-install-xrdp-on-raspberry-pi/

  • The Xrdp service will automatically start when the installation is complete. To verify that Xrdp is running enter the command systemctl show -p SubState --value xrdp.
  • This will print running in the Terminal if the Xrdp server is running correctly.

  • The pi user needs to be added to the ssl-cert group so that the Xrdp server can be used.
  • By default Xrdp uses the /etc/ssl/private/ssl-cert-snakeoil.key file which is readable only by users that are members of the “ssl-cert” group.
  • The ssl-cert-snakeoil.key is a server-specific public and private key pair created when the Xrdp server is installed.
  • The Keys permit encrypted communication.

Connecting from the PC to the MikroTik Router

  • Note – to connect to the router all computers need to be on the same network.
  • In this case it is a local home WiFi router.
  • To open WinBox navigate to the directory containing the file winbox.exe then enter the command wine winbox.exe
  • Note that the 64-bit version of winbox winbox64.exe will not work on 32-bit operating system architecture.

  • If wine is not installed enter the command sudo apt-get install wine
  • Wine is an application that allows you to run Windows programs on a Linux system

This will open up a WinBox home page.

To access the MikroTik router enter either the MAC address or the WiFi address for the router

  • Select the IP address for the MikroTik router (192.168.0.200) which has been set up as a static address on the home router.
  • Click on the Connect button.

  • This will open up a session showing the WinBox Dashboard

Wireless Configuration

  • Copy the following configuration for a basic setup using a home router.

  • At the WiFi Interfaces page click on Security Profiles

  • Ensure that passwords for both WPA and WPA2 are both activated.

Interface List configuration

  • An interface list needs to be created for the ethernet connection and the wireless connection to the MikroTik router.

  • The aim is to create a:
    • list named lan for ether1
    • list named wan for wlan1

Configure the WiFi

[[File:MikroTik router instructions 25.png | 900px]

Configure the wide area network – DHCP Client

Configure the Firewall

  • Connection state selected – however was not selected on my router initially???

Firewall Rules

NAT Network Address Translation