#!/bin/sh # Verbose #set -x # Openmoko Neo Freerunner GTA02 USB networking # take care, this script changes iptables-rules # in addition to the changes below, the machine that # has the Freerunner connected to it, must have # IP forwarding enabled: # echo "1" > /proc/sys/net/ipv4/ip_forward IFCONFIG_BIN="/sbin/ifconfig" ROUTE_BIN="/sbin/route" IPTABLES_BIN="/usr/sbin/iptables" case "$1" in start) $IFCONFIG_BIN usb0 192.168.0.200 netmask 255.255.255.0 up $ROUTE_BIN add -host 192.168.0.202/32 dev usb0 $IPTABLES_BIN -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 $IPTABLES_BIN -P FORWARD ACCEPT ;; stop) $IPTABLES_BIN -t nat -F POSTROUTING $ROUTE_BIN del -host 192.168.0.202/32 dev usb0 $IFCONFIG_BIN usb0 down ;; *) echo "Usage: $0 {start|stop}" exit 1 ;; esac