Docs
Doc / Cases / PLC-Remote
Turn a GL-MIFI into a PLC Remote Router
Legacy Notice: This guide uses OmniEdge v1.x for OpenWrt. OmniEdge v2.x for OpenWrt is coming soon. For new deployments on supported platforms, we recommend using OmniEdge v2.x.
Industrial PLC (Programmable Logic Controller) remote access typically requires expensive dedicated hardware. This guide shows how to build an affordable PLC remote router using a GL.iNet GL-MiFi with LTE and OmniEdge.
Hardware & Software
- Hardware: GL.iNet GL-MiFi with QUECTEL EC20 LTE module
- Software: OpenWrt 21.02.1
Note: We use OpenWrt 21.02 because it still supports iptables. OpenWrt 22.03+ uses nftables exclusively, requiring different firewall rules.
References
Router Setup
1. Install Required Packages
opkg update && opkg install \
usb-modeswitch kmod-mii kmod-usb-net kmod-usb-wdm \
kmod-usb-net-qmi-wwan uqmi kmod-tun ca-bundle \
luci-proto-qmi iptables kmod-usb-serial-option \
kmod-usb-serial kmod-usb-serial-wwan \
kmod-usb-net-cdc-mbim umbim2. Configure LTE Network
Edit /etc/config/network and add:
config interface 'modem'
option ifname 'wwan0'
option proto 'qmi'
option device '/dev/cdc-wdm0'
option apn 'YOUR_CARRIER_APN'Replace YOUR_CARRIER_APN with your mobile carrier's APN (e.g., 'ctnet', 'internet', etc.).
3. Configure Firewall
Edit /etc/config/firewall and add modem to WAN zone:
config zone
option name wan
...
list network 'modem'
...4. Configure LED Indicator
Edit /etc/config/system:
config led 'led_3gnet'
...
option dev 'wwan0'5. Reboot and Test
Restart your device. If configured correctly, the LTE connection should work.
Install OmniEdge
1. Download OmniEdge Package
For GL-MiFi (MIPS architecture):
wget https://github.com/omniedgeio/omniedge/releases/download/v0.2.4/omniedge_v0.2.4_mips_24kc.ipk
opkg install omniedge_v0.2.4_mips_24kc.ipk2. Configure OmniEdge
Generate a Security Key from OmniEdge Dashboard and note your Virtual Network ID.
Edit /etc/init.d/omniedge:
security_key=YOUR_OMNIEDGE_SECURITY_KEY
virtual_network_id=YOUR_VIRTUAL_NETWORK_ID3. Start OmniEdge
/etc/init.d/omniedge enable
/etc/init.d/omniedge startNote: After the first run, edit
/etc/init.d/omniedgeand remove the linecp /proc/sys/kernel/random/uuid /etc/machine-idto keep a stable virtual IP address.
4. Configure Firewall Rules
Set up NAT and forwarding (replace 100.100.100.0/24 with your virtual network range):
iptables -t nat -A POSTROUTING -s 100.100.100.0/24 -j MASQUERADE
iptables -A forwarding_rule -s 100.100.100.0/24 -j ACCEPT
LAN_DEV=$(ubus call network.interface.lan status | jsonfilter -e '@["device"]')
iptables -I FORWARD 1 -i $LAN_DEV -d 100.100.100.0/24 -j ACCEPT5. Make Rules Persistent
Create hotplug script:
cat > /etc/hotplug.d/iface/99-omniedge << 'EOF'
[ "${ACTION}" = "ifup" ] && {
logger -t hotplug "Device: ${DEVICE} / Action: ${ACTION}"
/etc/init.d/omniedge start &>/dev/null &
sleep 5
iptables -t nat -A POSTROUTING -s 100.100.100.0/24 -j MASQUERADE
iptables -A forwarding_rule -s 100.100.100.0/24 -j ACCEPT
LAN_DEV=$(ubus call network.interface.lan status | jsonfilter -e '@["device"]')
iptables -I FORWARD 1 -i $LAN_DEV -d 100.100.100.0/24 -j ACCEPT
}
EOFClient Setup
Windows
- Install OmniEdge Desktop for Windows
- Connect to the same virtual network as your router
- Open Command Prompt as Administrator:
route add 192.168.1.0 mask 255.255.255.0 100.100.100.46macOS
- Install OmniEdge CLI:
curl -fsSL https://raw.githubusercontent.com/omniedgeio/omniedge/main/scripts/omniedge-install.sh | bash
sudo omniedge start- Add route:
sudo route -n add -net 192.168.1.0 100.100.100.46Linux
- Install OmniEdge CLI:
curl -fsSL https://raw.githubusercontent.com/omniedgeio/omniedge/main/scripts/omniedge-install.sh | bash
sudo omniedge start- Add route:
sudo ip route add 192.168.1.0/24 via 100.100.100.46Parameters
- 192.168.1.0/24: LAN IP range where PLCs are connected
- 100.100.100.46: OmniEdge virtual IP of the GL-MiFi router
Access PLCs Remotely
Once configured, you can access PLCs on the router's LAN:
# Siemens S7 PLC
192.168.1.10:102
# Allen-Bradley PLC
192.168.1.11:44818
# Modbus TCP devices
192.168.1.12:502Use your standard PLC programming software (TIA Portal, RSLogix, etc.) with the PLC's LAN IP address.
Cost Comparison
| Solution | Approximate Cost |
|---|---|
| Industrial VPN Router (eWON, Tosibox) | $500-2000 |
| GL-MiFi + OmniEdge | ~$80 |
Future: OmniEdge v2.x for OpenWrt
OmniEdge v2.x brings improved NAT traversal and better performance. OpenWrt support is planned for a future release.
If you have more questions, feel free to discuss.
On This Page