Setting Wi-Fi Access Point with an MT100EOCG and an MTPCIE Bluetooth/Wi-Fi

To setup a Wi-Fi access point with an MT100EOCG and an MTPCIE Bluetooth Wi-Fi device:

  1. Build corecdp-wifi-ap-image and flash it into the MT100EOCG.
  2. Edit /etc/udhcpd.conf to configure the dhcp server.
  3. Edit /etc/hostapd.conf to configure access point settings. Configure ssid= with the access point name. Save hostapd.conf.
  4. To start the access point, type ocg-wifi-ap.sh start on the MT100EOCG. For example:
    ocg-wifi-ap.sh start 192.168.2.1
  5. If you run a script like the example, the MT100EOCG acts as a cell router that allows Wi-Fi and Ethernet endpoints to access the Internet through EOCG’s cellular PPP link. Uncomment the ppd call line for your device model.
  6. Create a wireless network connection on a remote computer and configure it to use DHCP to obtain IP and DNS addresses.
  7. Enable the wireless connection on the computer. Verify that your computer can communicate to the Internet using MT100EOCG as the access point.

Example Wi-Fi Access Point Script

#!/usr/bin/env bash

echo "Updating DNS, ppp scripts"
echo "nameserver 8.8.8.8" > /etc/resolv.conf

killall pppd && sleep 2

echo "Starting pppd"

#uncomment line below if gsm radio (H5, etc)
#pppd call gsm

#uncomment line below if cdma radio (EV3,etc)
#pppd call cdma

sleep 4
echo "Setting up iptables"

# Flush all the tables first
iptables -t filter -F
iptables -t nat -F
iptables -t mangle -F
iptables -t filter -P INPUT DROP
iptables -t filter -A INPUT -i lo -j ACCEPT
iptables -t filter -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

# accept all traffic from LAN
iptables -t filter -A INPUT -i eth0 -j ACCEPT
iptables -t filter -A INPUT -i wlan0 -j ACCEPT
iptables -t filter -P FORWARD DROP
iptables -t filter -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t filter -A FORWARD -i eth0 -o ppp0 -j ACCEPT
iptables -t filter -A FORWARD -i wlan0 -o ppp0 -j ACCEPT
iptables -t filter -P OUTPUT ACCEPT
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

# turn on packet forwarding last
echo 1 > /proc/sys/net/ipv4/ip_forward