Setting up MangOH Red as Router to Cellular Gateway


Objective: Configure a MangOH to route cellular internet data to/from other network interfaces. For example the image below shows how we will route traffic to/from the ethernet IoT slot to/from the cellular gateway.

Solution: To configure the MangOH to route data to/from network interfaces to/from the public cellular interface execute the following steps:

A. For wired interfaces, i.e. eth0 run the following steps:

  1. Download the script to the MangOH device (also found under /scripts in the
    MangOH GitHub) using the following:
    scp ./scripts/ root@

  2. ssh or console into the MangOH device.
    ssh root@

  3. Move to the /tmp directory (or directory where the script was copied to above)
    cd /tmp

  4. Run the script

  5. An example run of executing the script is shown below (note the default parameters are used):

david@sw-dclark:~/MTPublic4.3.0$ ssh root@
root@swi-mdm9x28:~# cd /tmp
root@swi-mdm9x28:/tmp# chmod +x
root@swi-mdm9x28:/tmp# ./
MangOH gateway configuration
Enter WAN (cellular) interface (default: rmnet_data0):
WAN interface rmnet_data0
Enter LAN interface (default: eth0):
LAN interface eth0
Enter LAN IP (default:
IP address (
Enter LAN Net Mask (default:
net mask (
Mounting LAN interface ‘eth0’ IP: ‘’, net mask: ‘’
Check SIM inserted…
SIM card is inserted and unlocked (LE_SIM_READY).

Mounting the relay interface ‘rmnet_data0’…
Enabling the radio on ‘rmnet_data0’…
Radio power is already set to ON.
Enter APN (default:
Enabling the data connection on ‘rmnet_data0’ using APN ‘’…
Setting up profile 1
Setting access point name … ok
Setting packet data protocol … ok
Setting Authentication … ok
Connecting … ok
Checking if device is up … ok
Routing … ok
Updating /etc/resolv.conf … ok
Updating /etc/resolv.conf … ok
Testing connection … Waiting for data connection on ‘rmnet_data0’…
Relay interface ‘rmnet_data0’ IP address is ‘’
Cleaning IP tables…
Enabling IP forwarding…
net.ipv4.ip_forward = 1
Configuring the NAT…
Configure DHCP server (Y/n): Y
Enter start IP (default:
IP address (
Enter end IP (default:
IP address (
Reconfiguring the DHCP server…
stopping DNS forwarder and DHCP server: dnsmasq… stopped /usr/bin/dnsmasq (pid 1196)
Generating the configuration file ‘/tmp/dnsmasq.eth0.conf’ for the DHCP server…
Restarting the DHCP server…
starting DNS forwarder and DHCP server: dnsmasq… done.
MangOH gateway configuration completed

  1. You can verify that the interface is up with the given parameters using ifconfig as shown below:

root@swi-mdm9x28:/tmp# ifconfig eth0
eth0 Link encap:Ethernet HWaddr AE:BA:5B:62:58:29
inet addr: Bcast: Mask:
inet6 addr: fe80::acba:5bff:fe62:5829/64 Scope:Link
RX packets:991 errors:0 dropped:0 overruns:0 frame:0
TX packets:1168 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:240898 (235.2 KiB) TX bytes:811303 (792.2 KiB)

B. For wireless interfaces, i.e. wlan0 (TI) or wlan1 (MT7692) run the following steps to configure a WiFi Access Point (AP):

  1. First follow the instructions for setting up the WiFi found on the MangOH Red Wiki (note that if the TI WiFi is used then the first 2 sections on this wiki can be skipped as they are required only for MediaTek7692 WiFi):
  1. Check if the WiFi AP web service is running using ‘app status’

root@swi-mdm9x28:/tmp# app status
[running] atAirVantage
[running] atQmiLinker
[running] atService
[running] audioService
[running] avcService
[running] cellNetService
[running] dataConnectionService
[running] fwupdateService
[running] gpioService
[running] modemService
[running] portService
[running] positioningService
[running] powerMgr
[running] secStore
[stopped] smsInboxService
[stopped] spiService
[stopped] tools
[stopped] voiceCallService
[stopped] wifi
[stopped] wifiApTest
[stopped] wifiClientTest
[running] wifiService
[stopped] wifiWebAp

  1. If the WiFi AP web service is stopped then start the web service using ‘app start wifiWebAp’

  2. From a web browser on a laptop/desktop PC connected to CF3 USB port on the MangOH goto the following local URL which can be used to configure the MangOH WiFi interface (wlan0, wlan1) as an AP:

Summary: The attached script which can also be found on the MangOH GitHub web site can be used to configure the MangOH as a gateway.

For example, when I tested the script I wanted to create a gateway between the ethernet IoT slot (eth0) and the cellular interface (rmnet_data0). After running the script I was able to connect my lap top to the ethernet port on the MangOH Red IoT slot and use the cellular interface (rmnet_data0) for internet access. (8.3 KB)

Internet Access with Mangoh Red over PC
Connecting a camera to the mangOH Red
Unable to use USB to Ethernet IOT card
Unable to use USB to Ethernet IOT card

Cool use case and tutorial :fire::clap:t3:. Thanks for sharing @dclark75.


HOWTO Guide or WIKI candidate for sure