OCG Scripts

The ocg-scripts recipe provides a small set of simple scripts that are useful for demos, testing, and as examples for developers. They are not intended to be full-featured scripts that cover a wide-range of use cases.


Configures the OCG as a basic network router/firewall. All incoming connections on the WAN are blocked by default and all outbound traffic from the LAN is allowed. Enables IP forwarding and masquerading/NAT.

  Usage: ocg-cell-router start|stop [options]
      -l  LAN interfaces to allow, comma-separated (defaults to "eth0")
      -w   WAN interface to route out (defaults to "ppp0")


Helper script to set the APN in the /etc/ppp/peers/gsm_chat file, rather than having to edit it by hand.

  Usage: ocg-set-apn APN


Simple script to stop and start the busybox udhcpd server. To edit dhcpd config, edit /etc/udhcpd.conf. The default configuration works with the default IP address of and subnet mask of

  Usage: ocg-dhcpd start|stop|restart


Enables a Wi-Fi AP on the OCG. Tested with MT100EOCG + MTPCIE-H5-BW with integrated Bluetooth/Wifi (other hardware configurations don’t have Wi-Fi support).

Starts and stops hostapd and dhcpd with some minimal configuration. By default, it enables an access point on so as not to conflict with the default ethernet address of DHCP server will run on Wi-Fi only unless it is bridged with the ethernet interface.

The script will only automatically modify a few settings. Any other changes need to be made to /etc/hostapd.conf and /etc/udhcpd.conf manually.

Automatically enables/disables bridge mode in /etc/hostapd.conf as needed
Configures router address and DHCP address range in /etc/udhcdp.conf to match wlan0 address if “-a” option is used

  Usage: ocg-wifi-ap start|stop|restart [options]
Sets AP IP address (defaults to -b Add AP to specified bridge interface (conflicts with -a)


Ethernet to Cellular router example
ocg-set-apn APN (one-time only for GSM connections)
ocg-cell-router start
ocg-dhcpd start
pppd call gsm
Wifi AP to Cellular router with Ethernet on separate subnets and DHCP on Wifi only
ocg-set-apn APN (one-time only for GSM connections)
ocg-cell-router start -l eth0,wlan0
ocg-wifi-ap start
pppd call gsm
Wifi AP and Ethernet bridged Cellular router
Edit /etc/network/interfaces -- enable br0 and disable normal eth0 setup
ocg-set-apn APN (one-time only for GSM connections)
ocg-cell-router start -l br0
ocg-wifi-ap start -b br0
pppd call gsm