OpenWrt Forum Archive

Topic: Configure WRT54G/Backfire to Use a WiFi WAN Gateway?

The content of this topic has been archived on 24 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I've got a WRT54G v2.2 running Backfire 10.03.  I wish to configure it to use an Android device as a WAN gateway (via WiFi) for computers connected to the LAN (via the ethernet ports).  The Android device seems to provide NAT and DHCP, and uses the Ad-Hoc type of network (It's Barnacle WiFi Tether: http://szym.net/barnacle/ ).  Its encryption can be none, or WEP.

(Please forgive me if I use the wrong terminology here and there for this network stuff--it's not something on which I have a strong grasp.)

I've spent some time reading OpenWRT documentation and exploring the shell and http interface, but I'm still not quite confident on where to begin.  Am I correct in thinking I can do the configuration largely by editing the files in /etc/config?

Does the device broadcast an SSID? In other words, if you use another wifi enabled device can you see the Android as a wifi point?

Hi, philchetcuti.  Yes, the Android device can be made to broadcast the SSID.  For example, I can see the device as an Ad-Hoc WiFi point in the NetworkManager applet on my Toshiba laptop running Ubuntu Jaunty.

you are right about the /etc/config, in fact you need to start with /etc/config/wireless
full description of that file and its settings is at http://wiki.openwrt.org/doc/uci/wireless

roughly you need to make your /etc/config/wireless look somewhat as follows

config 'wifi-device' 'wl0'
        option 'type' 'broadcom'
        option 'channel' '5'
        option 'disabled' '0'

config 'wifi-iface'
        option 'device' 'wl0'
        option 'ssid' 'AndroidSSID'
        option 'network' 'wan'
        option 'mode' 'sta'
        option 'encryption' 'wep'
        option 'key' 'wepkeyforandroid'

Make sure you set channel to the channel that android is broadcasting on.

If you are currently using your WRT54G as a wireless device then you need more settings in that file which will allow you to use AP and STA modes at the same time. But you did say ethernet ports so I listed only the changes for STA or client mode.

(Last edited by philchetcuti on 2 Sep 2011, 00:42)

Thank you both.  I started by using 'Reset router to defaults' in the OpenWrt http interface, and have now got this working to a large degree.

Once connected to the Android device using the following /etc/config/wireless, the WRT54G gets an IP address, can access the internet, and does NAT for PC on the wired LAN:

config 'wifi-device' 'radio0'
    option 'type' 'mac80211'
    option 'channel' '6'
    option 'macaddr' '00:14:bf:1b:d2:3c'
    option 'hwmode' '11g'
    option 'disabled' '0'

config 'wifi-iface'
    option 'device' 'radio0'
    option 'ssid' '(the ssid)'
    option 'encryption' 'wep'
    option 'key' '(the key)'
    option 'network' 'wan'
    option 'mode' 'adhoc'

But I'm having trouble initiating the Ad-Hoc WiFi connection between the WRT54G and the Android device's Barnacle WiFi Tether program.  I start the Barnacle program, power up the WRT54G, and wait, but the WRT54G never appears in Barnacle for me to authorize NAT.  I found I can make it work by initiating a connection to the Android device from my notebook PC; then both the PC and the WRT54G appear in Barnacle for me to authorize NAT.

Any ideas about what this might mean and how to initiate the connection from the WRT54G alone?

The discussion might have continued from here.