Docs
Doc / Cases / PLC-Remote
Turn a GL- MIFI into a $2000 PLC remote router
Reference:
Router Setup
Hardware: GL.iNet GL-MiFi, with QUECTEL EC20 LTE module. Software: OpenWrt 21.02.1
Note: The reason for not using the latest version 22.03 is that it has abandoned the use of iptables and instead uses ntftables exclusively, which makes the iptables rules unavailable. If you need to use the latest version of OpenWrt, you need to convert to new nft rules.
- Install the necessary 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 umbim
- Configure the network by modifying the
/etc/config/network
file and adding the following content at the end:
config interface 'modem'
option ifname 'wwan0'
option proto 'qmi'
option device '/dev/cdc-wdm0'
option apn 'ctnet'
Fill in the 'apn' field with different content according to your own carrier.
Configure the firewall by modifying the /etc/config/firewall file and adding the modem to the WAN section.
config zone option name wan ··· list network 'modem' ···
Configure the led by modifying
/etc/config/system
config led 'led_3gnet'
···
option dev 'wwan0'
- Restart your device, and if there are no issues, you should be able to access the internet
- Install OmniEdge, set the the Router's LAN Range, for example: 192.168.1.0/24.
- Download OmniEdge,the version for GL-MIFI is:https://github.com/omniedgeio/omniedge/releases/download/v0.2.4/omniedge_v0.2.4_mips_24kc.ipk, Copy the ipk to router and install it by run
opkg install omniedge*.ipk
- Generate Security key and get virtual network ID form Omniedge Dashboard
- Add the Security Key and Virtual Network ID to
/etc/init.d/omniedge
:
security_key=OMNIEDGE_SECURITY_KEY
virtual_network_id=OMNIEDGE_VIRUTALNETWORK_ID
- Enable and Start OmniEdge:
/etc/init.d/omniedge enable
/etc/init.d/omniedge start
After running Omniedge for the first time, modify the 'start' function in
/etc/init.d/omniedge
by removing the line 'cp /proc/sys/kernel/random/uuid /etc/machine-id' to prevent the IP address from changing each time.
- Configure the firwall:
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
Here: - 100.100.100.0/24: is the IP of OmniEdge
- To start the OmniEdge automatically on boot after network
#vim /etc/hotplug.d/iface/99-omniedge
[ "${ACTION}" = "ifup" ] && {
logger -t hotplug "Device: ${DEVICE} / Action: ${ACTION}"
/etc/init.d/omniedge start &>/dev/null &
wait 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
}
To access LAN devices from a client through OmniEdge
Setup on Windows
- Install OmniEdge For Windows
Doc: https://omniedge.io/download/windows
- Run
cmd
as administrator, and set the route
route add 192.168.1.0 mask 255.255.255.0 100.100.100.46
Setup on MacOS
- Install OmniEdge for macOS
Doc: https://omniedge.io/download/macos
- Set the route
sudo route -n add -net 192.168.1.0 100.100.100.46
Here:
- 192.168.1.0: LAN IP range of the OpenWrt Router
- 100.100.100.46: OMNIEDGE IP of OpenWRT Router
If you have more questions, feel free to discuss.
On This Page