I have cheap IoT device from Orangepi running raspbian server with wlan0 and ppp0 interfaces. wlan0 will be connected to access point in the local network. the ppp0 interface will be connected to GSM network through /dev/modem0 and provide internet access for the device.

  1. want orangePi to be able to connect internet itself through ppp0
  2. want all devices in the local network that will be connected to router/access point be able to connect to the internet through IoT ppp0 interface
  3. also want to be able to setup port forwarding from ppp0 interface to some devices in the local network

What will be the best approach to do it and how to configure IoT Linux box?


On th highest level, orange pi will act as an Internet gateway for your network. Basically you need to configure orange pe as an router, the most common is to use NAT for this.

LAN --- WIFI --- OrangePI --- PPP --- GSM

so you need to find out the following:

how to configure your GSM for raspbian - I'd suggest to look this up according to your modem model.

How to configure NAT between WAN and PPP (this is described for many distros and should be same for this one).

How to make port forwarding in Linux (described in many howtos too).

Network devices accessing to the internet via Orange pi will have to be able to reach orange pi's wifi's ip address.

Network devices accessing to the internet via Orange pi will need to have orange pi's wifi's ip address set as gateway.


So here's how I did it:

  1. Turn off power management on Orange PI. Add following line to /etc/network/interfaces

    iw dev wlan0 set power_save off

  2. Enable IP Forwarding. Add following line in /etc/sysctl.cong


  3. Enable NAT. Run following commands:

    sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

    sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT

    sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

and to permanently apply rules type this command

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

and add following code to /etc/network/interfaces

up iptables-restore < /etc/iptables.ipv4.nat
  1. Configure wvdial and test if it connects to GSM network. Create following script

    #! /bin/bash ( while : ; do wvdial sleep 10 done ) &

and add above script to be run in /etc/rc.local file.

Sources are: virtono.com elinux.org wiki.archlinux.org

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.