Other Android phones and routers are similar. If you are using a different router, make sure you use the correct usb2 driver - ohci or uhci. If you are using a different Android phone, change your vendor and device ID in hotplug script to match your model. You can get them with 'lsusb' command on linux.

I wanted to be close to bleeding edge for broadcom stability on 2.6 kernel, so I've used
http://downloads.openwrt.org/snapshots/ … uashfs.trx
I had to tweak /etc/opkg.conf to correct the path to packages.

Start by installing the required kernel modules:

opkg update && opkg install kmod-nls-base kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-net kmod-usb-net-cdc-ether kmod-usb-net-rndis

Make sure to replace ohci module with uhci if your router needs this.

Instead of manually entering commands with uci we will import the complete sections. Create two files in /tmp/:

ucifirewall.txt

package 'firewall'

config 'zone'
    option 'name' 'wan'
    option 'input' 'REJECT'
    option 'output' 'ACCEPT'
    option 'forward' 'REJECT'
    option 'masq' '1'
    option 'mtu_fix' '1'
    option 'network' 'wan usb0 ppp0'

ucinetwork.txt

package 'network'

config 'interface' 'usb0'
    option 'name' 'usb0'
    option 'proto' 'dhcp'
    option 'ifname' 'usb0'
    option 'defaultroute' '0'
    option 'peerdns' '0'

Execute:

cat /tmp/ucinetwork.txt | uci import && cat /tmp/ucifirewall.txt | uci import && rm /tmp/uci*.txt

In /etc/hotplug.d/usb create '20-usb-htc-evo'. Change the name to match your device.

20-usb-htc-evo

#!/bin/sh

# the product string for the HTC EVO 3G
HTC_EVO="0bb4/0ffe/0"

# the target we are looking for
TARGET_PRODUCT=${HTC_EVO}

case "$ACTION" in
    add)

        [ ${PRODUCT} == ${TARGET_PRODUCT} ] &&
        [ -n "${INTERFACE}" ] &&
        [ "$(expr substr ${INTERFACE} 1 2)" == "8/" ] && {
            /sbin/ifup usb0&
        }
        ;;
esac

Change the line 'HTC_EVO="0bb4/0ffe/0"' to match your phone's vendor and device ID. You can get these values by running lsusb -v in linux or in device manager on windows.

Reboot the router.

Now when you change the usb mode to tethering your router will use the phone as a WAN interface.

(Last edited by 2real4u on 11 May 2011, 06:20)