Moxa UC Series Setup¶
This document outlines setting up a Moxa UC series gateway from a factory image.
To order a gateway pre-configured to connect to Exosite, Industrial Networking Solutions sells a WiFi/Ethernet kit and a Cellular kit. Use of these preconfigured kits is documented here.
Connecting to the Gateway¶
Power¶
When attaching the power barrel jack, attach the wire with dashes to the V+ terminal.
Internet¶
Connect the LAN1 port to an internet router.
Via Serial Connection¶
Connect with a 115200 baud serial connection
Example with 'screen':
screen -L /dev/cu.usbserial-<ID> 115200
Initial Setup¶
Login¶
Default credentials are moxa:moxa
Access Internet¶
Give the Moxa a dynamic IP address by modifying ' /etc/network/interfaces'
sudo vim /etc/network/interfaces
Remove
iface eth0 inet static
address 192.168.3.127
network 192.168.3.0
netmask 255.255.255.0
broadcast 192.168.3.255
And change to
iface eth0 inet dhcp
Reboot the Moxa Gateway
sudo reboot
After logging back in
ping 8.8.8.8
Should output something similar to:
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=56 time=11.0 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=56 time=10.8 ms
Update apt-get packages¶
sudo apt-get update
Install Python and PIP
sudo apt-get install python3-pip -y
Install ExoEdge Base¶
pip3 install exoedge
This will install ExoEdge to '/home/moxa/.local/bin/'
Install ExoEdge Sources¶
Any ExoEdge sources can be installed, for example, to install the modbus source, execute the following:
pip3 install exoedge-modbus
Create ExoEdge Configuration¶
Create a file called 'edged.ini' in the home directory:
vim ~/edged.ini
Enter the following contents
[device]
murano_host = https://<iot_connector_fqdn>/
murano_id = <serial_number>
Start ExoEdge on Boot¶
Create a file edged.service
vim ~/edged.service
Enter the following contents:
[Unit]
Description=Edged
Documentation=https://pypi.org/project/exoedge/ https://community.exosite.com/c/exoedge
[Service]
User=moxa
Group=moxa
ExecStart=/home/moxa/.local/bin/edged -i /home/moxa/edged.ini go
Restart=always
[Install]
WantedBy=multi-user.target
Then run the following commands:
> sudo cp edged.service /etc/systemd/system/
> sudo systemctl daemon-reload
> sudo systemctl enable edged.service
> sudo systemctl start edged
Add VPN \(Optional\)¶
Adding a VPN will help enable remote access to the Moxa Gateway for assisting in updates/troubleshooting/or programming of PLCs. This example shows setting up a wireguard VPN connection.
Add the wireguard repository
sudo vim /etc/apt/sources.list.d/unstable-wireguard.list
Add the following contents:
deb http://deb.debian.org/debian/ unstable main
Update apt
sudo apt-get update
Install Wireguard
sudo apt-get install wireguard-dkms wireguard-tools -y
Configure Wireguard:
sudo vim /etc/wireguard/wg0.conf
Then add the following to that file.
Warning
Remember to set the client private key and server public key to their corresponding places and also include your WireGuard server’s public IP address.
[Interface]
Address = 10.0.0.2/32
PrivateKey = <contents-of-client-privatekey>
DNS = 1.1.1.1
[Peer]
PublicKey = <contents-of-server-publickey>
Endpoint = <server-public-ip>:51820
AllowedIPs = 0.0.0.0/0, ::/0
Start WireGuard
sudo wg-quick up wg0
Enable wireguard start-on-boot
sudo systemctl enable wg-quick@wg0
Troubleshooting¶
Reseting the Moxa Gateway¶
Danger
This will remove all data and configurations. It will also uninstall ThingsPro if it's installed.
sudo mx-set-def
SSH using hostname¶
Since the Moxa gateway may need a dynamic IP address to access the internet, the IP address may not always be the same. To mitigate connection issues, a hostname can be set.
- Type the following command to edit /etc/hostname using nano or vi text editor:
sudo nano /etc/hostname
Delete the old name and setup new name. - Next Edit the /etc/hosts file:
sudo nano /etc/hosts
Replace any occurrence of the existing computer name with your new one. - Install required services**
sudo apt-get install avahi-daemon avahi-discover libnss-mdns
** - Reboot the system to changes take effect:
sudo reboot
Then, the gateway should be able to be accessed via ssh with
ssh moxa@<hostname>.local
Where 'hostname' is the contents of /etc/hostname on the Moxa
Cell connection drops¶
If the cell connection drops, or needs to start on boot, this cellular-keepalive script can be used: