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.

  1. 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
  1. 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.

  1. 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'
        ···
    
  2. Configure the led by modifying /etc/config/system

    config led 'led_3gnet'
        ···
        option dev 'wwan0'
    
  3. Restart your device, and if there are no issues, you should be able to access the internet

  4. Install OmniEdge
    1). The Router’s LAN Range: 192.168.1.0/24
    2). 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
    3. Copy the ipk to router and install it by run opkg install omniedge*.ipk
    4. Generate Security key and get virtual network ID form Omniedge Dashboard
    5. Add the Security Key and Virtual Network ID to /etc/init.d/omniedge:

	security_key=OMNIEDGE_SECURITY_KEY
	virtual_network_id=OMNIEDGE_VIRUTALNETWORK_ID
	6. 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.

  1. 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
8.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

  1. Install OmniEdge For Windows

  2. 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

  1. Install OmniEdge for macOS

  2. 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

Thanks for your share.

1 Like