OpenWrt Forum Archive

Topic: wrt54gl & kamikaze 7.06 in client mode

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

Hi,
how do i make my wrt54gl router with kamikaze 7.06
to work in client mode. I manged it to work in client mode
with whiterussian firmware but i could not find any doc
how to set it up with kamikaze firmware.
any help would be appreciated,
thanks.

It's very similar, except that the values that you want to set aren't in nvram but are in variables in the files in /etc/config/

Thanks for ur reply, I tried that, and the result as follows,
Why it says REPEATER not STA ? The router did not
acquire a valid ip via DHCP...or Am I wrong ?

thanks again,

vi /etc/config/wireless gives this

config wifi-device  wl0
        option type     broadcom
        option channel  9
# disable radio to prevent an open ap after reflashing:
#        option disabled  1

config wifi-iface
        option device   wl0
    option network     lan
        option mode     sta   
        option ssid     openwrt
        option hidden   0
        option encryption none



iwconfig gives this, plse note it says REPEATER not STA why ?

wl0       IEEE 802.11-DS  ESSID:"openwrt"
          Mode:Repeater  Frequency:2.452 GHz Access Point: 00:0D:45:89:1B:DC 
      Tx-Power: 19 dBm
          Link Signal level:-85 dBm  Noise level:-99 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:9  Invalid misc:0   Missed beacon:0

I've got a wrtsl54gs, not a straight 54g, but here's my /etc/config/wireless (with my local wireless info replaced with all caps):

config wifi-device  wl0
        option type     broadcom
        option channel  MYCHANNELNO
# disable radio to prevent an open ap after reflashing:
        option disabled 0

config wifi-iface
        option device   wl0
        option network  wan
        option mode     sta
        option ssid     MYSSID
        option hidden   0
        option encryption none

Here's my /etc/config/network:

#### VLAN configuration 
config switch eth0
        option vlan0    "0 1 2 3 4 5u"


#### Loopback configuration
config interface loopback
        option ifname   "lo"
        option proto    static
        option ipaddr   127.0.0.1
        option netmask  255.0.0.0


#### LAN configuration
config interface lan
        option type     bridge
        option ifname   "eth0"
        option macaddr  "00:18:F8:BD:8E:0B"
        option proto    static
        option ipaddr   192.168.1.1
        option netmask  255.255.255.0


#### WAN configuration
config interface        wan
        option ifname   "eth2"
        option macaddr  "00:18:f8:bd:8e:0c"
        option proto    dhcp

Btw, the salient differences is that you've still got your wireless on your lan (which is typically configured statically) whereas I've got mine on the wan (which is configured via dhcp). I can't imagine why you'd want your wifi to be a client if it's not your wan (i.e. upstream internet connection), so that might be your problem.

Note: if you're trying to configure your wifi as a bridge (i.e. "wet" rather than "sta"), my guess is that you'll want to leave it on the lan. I don't know how to change the various scripts to get that to work, though.

Here's my config files, running routed client mode on my WRT54GL 1.1 ... pretty much the same as ctl's setup:

/etc/config/network

config switch eth0
        option vlan0    "0 1 2 3 4 5*"

config interface loopback
        option ifname   "lo"
        option proto    static
        option ipaddr   127.0.0.1
        option netmask  255.0.0.0

config interface lan
        option type     bridge
        option ifname   "eth0.0"
        option proto    static
        option ipaddr   192.168.2.1
        option netmask  255.255.255.0

config interface wan
        option ifname   wl0
        option proto    dhcp

/etc/config/wireless

config wifi-device wl0
        option type             broadcom
        option disabled         0

config wifi-iface
        option device           wl0
        option network          wan
        option mode             sta
        option ssid             linksys

Thank you "ctl" and "Duon", It worked.

Duon wrote:
config interface wan
        option ifname   wl0
        option proto    dhcp

Bad example.

Don't use "option ifname" to specify a wireless interface.

The names of the wireless interfaces are dynamically assigned and should not be hardcoded. Instead you should remove the "option ifname wl0" in your /etc/config/network and replace it with a "option network wan" in your /etc/config/wireless, which will configure the wireless interface as per the "wan" section.

(Yes, you can have a config section in /etc/config/network without an ifname)

mbm,

I already have "option network wan" in my wireless config, and once I removed the "option ifname wl0" line from network, I could no longer connect.  What did I miss? hmm

Duon: You have not missed anything. You MUST include the ifname in case of the wireless wan configuration until all other applications and scripts are fixed.

mbm: The idea of the dynamic wireless config is clever. But all applications and scripts in OpenWrt expects the ifname in the network config in case of the wan interface. There are many of the scripts that cannot work without setting the ifname in the interface section, for example firewall, miniupnpd and other init scripts requiring the wan interface. The /lib/network/config.sh, scan_interfaces() does not take the dynamic wireless configuration into account.

On my WRTSL54GS, 7.06 wasn't able to find the wireless hardware at all (no eth2).  I installed 7.07, which does find it, and now I'm trying to configure it as a client, using the configuration ctl provided above.  I put in the /etc/config/network and /etc/config/wireless files, exactly as he provided, except that I put in my wireless ESSID and channel, changed the LAN IP address to 192.168.2.1 (rather than 192.168.1.1), and removed the mac address options (I've tried with and without).

The result I get is that the config files seem to be completely ignored when I reboot.  I can ssh in and verify that they're still there and have the contents I put in, but it still comes up with the LAN at 192.168.1.1, and with the wireless (eth2) in AP mode and bridged to the LAN (rather than the WAN).

I must be overlooking something really basic.  What am I doing wrong?

Thanks,
Eric

Nevermind, I found what I was doing that was *incredibly* stupid.  I thought I'd installed 7.07, but I didn't pay attention to the banner.  Actually I'd installed whiterussian 0.9.  (It would be nice if the firmware filenames incorporated the release number!)

Once I installed 7.07, and put in the right config files, everything started working just fine.

Thanks to ctl for sharing his config; I think it would have taken me a long time to figure out how to do it from the docs.

Eric

I have a different config that I think people might find useful. I have a [ROUTER] attached to my cable modem with IP address 192.168.0.1 . I have an media center in my living room I want to stream to which I will name [MED]. I also want to be able to connect to my [WRT] box from [MED], and computers attached to [ROUTER]. Therefore I used the following config. *Note your dns settings might be different, but you MUST set your gateway settings


/etc/config/wireless

config wifi-device  wl0
    option type     broadcom
    option channel  5

    # REMOVE THIS LINE TO ENABLE WIFI:
    option disabled 0

config wifi-iface
    option device   wl0
    option network    lan
    option mode     sta
    option ssid     EARTH
    option encryption wep
        option key      1
        option key1     0000000000000000000000000

/etc/config/network

#### VLAN configuration 
config switch eth0
    option vlan0    "1 2 3 4 5*"
    option vlan1    "0 5"


#### Loopback configuration
config interface loopback
    option ifname    "lo"
    option proto    static
    option ipaddr    127.0.0.1
    option netmask    255.0.0.0


#### LAN configuration
config interface lan
    option type     bridge
    option ifname    "eth0.0"
    option proto    static
    option ipaddr    192.168.0.254
    option netmask    255.255.255.0
        option gateway  192.168.0.1
        option dns      192.168.0.1


#### WAN configuration
config interface    wan
    option ifname    "eth0.1"
    option proto    dhcp

Well, frustrated by my inability to get WDS mode working on WRTSL45GS + 7.09 I have tried Duon's scripts.  No joy.  Can someone append an "ifconfig" from a working config?  My 'wl0' port doesn't acquire a DHCP address from the AP.  The output if "iwconfig" looks funky (note Tx-Power):

          wl0       IEEE 802.11-DS  ESSID:"OpenWrt"
          Mode:Repeater  Frequency:2.447 GHz  Tx-Power:off
          RTS thr:off   Fragment thr:off
          Encryption key:off
          Link Signal level:-11 dBm  Noise level:-96 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:7  Invalid misc:0   Missed beacon:0

and I'm seeing framing errors on the 'wl0' i/f in 'sta' mode (just like I did when I tried 'wds' mode, but fewer of them.)  I'm starting to believe the Broadcom wireless driver in K7.09 is BOGUS!  Any help would be appreciated.

(Last edited by kerlyn2001 on 16 Apr 2008, 02:10)

Success!  The problem was in the way I tried to fix the WRTSL54GS wl0 MAC issue (see https://dev.openwrt.org/ticket/947).   My MAC address hack has to precede "/sbin/wifi up" or modes other than AP won't work.

I know this is an old thread and I apologize for posting in it. I’m posting here rather then starting a new thread because I have questions that relate to ctl’s and duon’s posts.

I’m trying to get  “routed client mode�  working (that’s what we call this?).  My neighbor and I, at our summer cottages, want to share the cost of an internet connection. I have a WRT54GL running Kamikaze 7.09 and his is a Dlink with  standard Dlink firmware.

The Dlink is using the 192.168.2.0 subnet and the Linksys is using 192.168.1.0. The Linksys  (via DHCP) gets an IP from the Dlink and places it on br-wan. Br-wan is a bridge between eth0:1 and wl0.  The firewall is up and masquarding is enabled. The routing table shows the default route via the 192.168.2.1 gateway.


Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 br-wan
192.168.1.0     *               255.255.255.0   U     0      0        0 br-lan
default         192.168.2.1     0.0.0.0         UG     0      0        0 br-wan


On the Linksys router (OpenWRT)  I can get to any machine and the world. All is good. The issue is with any wired machines connected to the Linksys switch. They can ping the router’s 192.168.2.x interface but that’s where it stops. They can’t reach 192.168.2.1 or the internet. And yes, their default routes are set to the Linksys router (192.168.1.124).

I guess the obvious question is, “why don’t it work?�  but I have a couple of others. Why is clt & duon changing the switch setting for vlan0? I tried it and it didn’t fix the problem but I don’t understand, it’s necessity. Why is clt changing the HW addresses on the interfaces?  Again, I tried this but it did not fix the problem. Do I need certain numbers?

What am I missing? To me, it seems like the Linksys is not routing the packets to the 192.168.2.1 gateway?

(Last edited by nuke12 on 11 May 2008, 16:32)

Well, I didn’t receive any help but I did get it working. Un-said in my first post, I wanted to do this in a script. I wanted to keep my regular configs when the router was at home and script the “routed client mode�  when at the cottage. My failing was not dropping the firewall and restarting it.

I think this method is simpler then what ctl or duon is using if your trying to setup “routed client mode�  within a script. The reason, no switch changes are necessary, the lan side stays static and if connected via ssh, you can run the script without being disconnected or the necessity of rebooting.

So, here goes;

#!/bin/sh

if test $# -eq 0
then echo ""
     echo "Select Wireless Network to Join"
     echo "Option: Enter Network ESSID"
     echo ""
     exit
fi

/etc/init.d/firewall stop
ifdown wan
wifi down
uci set wireless.cfg2.ssid=$1
uci set wireless.cfg2.mode=sta
uci set wireless.cfg2.encryption=none
uci set wireless.cfg2.network=wan
uci set network.wan.proto=dhcp
uci set network.wan.type=bridge
ifup wan
wifi up
/etc/init.d/firewall start

This sets up a bridge (br-wan) between eth0.1 & wl0 and sets the IP on the bridge. The script also assumes you have the wireless running as an access point and your connecting to an open access point. You will need more wireless settings if your connecting to an encrypted network. Probably some of these;

option encryption  wep, psk, psk2, wpa, wpa2
option key encryption key
option key1 key 1
option key2 key 2
option key3 key 3
option key4 key 4

The basic script, gives the same rip-off features to join a network, as Blue Box.

I hope this helps others.

P.S. - please note, I don't "uci commit" anywhere in the script. That way the changes only exist between reboots and only when the script is run.

(Last edited by nuke12 on 12 May 2008, 22:37)

nuke12, this is a pretty elegant approach!

Did you change any of the other config files, or was it all in this script? Basically, you just installed the stock Kamikaze, added your script, and you were ready to go and connect?

airsurfer wrote:

nuke12, this is a pretty elegant approach!

Did you change any of the other config files, or was it all in this script? Basically, you just installed the stock Kamikaze, added your script, and you were ready to go and connect?

Well, I no longer have the stock settings so I can't say for sure but the approach should work with the stock Kamikaze 7.09. I'm new to OpenWRT and Kamikaze so I really don't know what changes have happened between versions.

Run the script on your router and see if it works. If it does not, then you will need some edits.


I'm going to use the same approach to set up WDS. I'm looking at this thread http://forum.openwrt.org/viewtopic.php?id=10514 and trying to build a script from it.

WDS works fine with this method. Again, this assumes the router is configured as a standard AP before running the script.

#!/bin/sh

wifi down
uci set wireless.cfg2.ssid={ SSID of the other router }
uci set wireless.cfg2.bssid={ MAC address of the other router }
uci set wireless.cfg3=wifi-iface
uci set wireless.cfg3.TYPE=wifi-iface
uci set wireless.cfg3.device=wl0
uci set wireless.cfg3.network=lan
uci set wireless.cfg3.mode=wds
uci set wireless.cfg3.ssid=wds
uci set wireless.cfg3.bssid={ MAC address of the other router }
wifi up
echo ""
echo "Router is now running in the WDS mode"
echo ""

Both routers have to be on the same channel and it's more seamless when they share the same SSID.

Kamikaze 7.09 does not seem to have the same issue as mentioned in the other thread. This version brings up the wds0.1 interface and assigns it to the br-lan bridge

Tested between a WRT54GL running Kamikaze 7.09 and a WRT54GS v7 running DD-WRT v24 RC-6 (01/02/08) micro - build 8743

nuke12 wrote:

WDS works fine with this method. Again, this assumes the router is configured as a standard AP before running the script.

I am trying to use mine as an access point in my car. I plan on using a USB DUN to my phone and connect to the evdo network. Has anyone done anything similar. I am having a hard time figuring out how to disable the bridge and get it to route correctly. I would prefer to do it scripted like nuke12 did. Any help would be greatly appreciated.

-j

The discussion might have continued from here.