OpenWrt Forum Archive

Topic: iwconfig vs wlconf ws wl

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

Hi

Did anyone suceed in using iwconfig to setup the wireless interface?. I spent several hours trying to get it to work, and iwconfig shows the correct settings, my the wrt54g is not visible to wireless client (in ap mode), or doesn't manage to associate with an ap (in client mode).

Client mode works when using the "wl" binary that comes with the original linksys firmware (I copied it over to the ap running openwrt). I just need to do "wl scan", "wl scanresults", "wj join .... " and the interface goes up, and is connected to my ap.

AP-Mode did work with neither wl nor with iwconfig. I got it to work by storing the settings to the nvram, and then doing "wlconf eth2 up".

To me, it looks like iwconfig does the correct settings (at least for ap mode), but leaves the radio disabled, or something like that.

My (ultimate) goal is to add wireless support to debian's ifup/ifdown programms, and to port them to openwrt - but to make this work, I need to figure out the different between wl, iwconfig and wlconf first.

greetings, Florian Pflug

My (ultimate) goal is to add wireless support to debian's ifup/ifdown programms

Debian's ifup / ifdown do already have support for the wireless tools (i.e. iwconfig). From "man 5 interfaces":
Additional options can be made available by other Debian packages.  For
       example, the wireless-tools package makes available a number of options prefixed with "wireless-"  which  can  be
       used to configure the interface using iwconfig(8)

My /etc/network/interfaces looks like (on my desktop machine):
iface wlan0 inet static
    address 192.168.2.2
    netmask 255.255.255.0
    broadcast 192.168.2.255
    gateway 192.168.2.1
    wireless-essid kohlfurterNR2
    wireless-channel 1
    wireless-mode managed

But that's actually good news, makes it easier for you to port ifup/ifdown to OpenWRT  smile

Let me know when you have created a package

Did anyone suceed in using iwconfig to setup the wireless interface?. I spent several hours trying to get it to work, and iwconfig shows the correct settings, my the wrt54g is not visible to wireless client (in ap mode), or doesn't manage to associate with an ap (in client mode).

Hi Florian,

I tried to use the iwconfig tool as you said. I had the same problem. The only mode I could get it working was master mode. The strange thing is that iwconfig shows the right configuration when called without an argument. When I changed eth2 to ad-hoc modus, my windows laptop could even see it. The windows laptop could even associate to the ad-hoc-wrt54g, at least it told me so. However, pinging the ad-hoc-wrt54g did not work.

The same is true for setting a linksys into managed mode and having it associate as a client to another master-linksys. The managed linksys can see the master linksys, at least it tells one so by the correct  "Access Point:"-Field in the output of iwconfig:

 Access Point: 00:06:25:FF:77:FF

00:06:25:FF:77:FF is the mac address of the master linksys (I verified this). However pinging between client and master linksys does work either.

Florian, was it the same for you, I mean, that associating seemed to work, but ping did not?

Besides I used beta4 on the client and sveasoft satoripre3 on the master.

regards,

jens

I tried to use the iwconfig tool as you said. I had the same problem. The only mode I could get it working was master mode. The strange thing is that iwconfig shows the right configuration when called without an argument. When I changed eth2 to ad-hoc modus, my windows laptop could even see it. The windows laptop could even associate to the ad-hoc-wrt54g, at least it told me so. However, pinging the ad-hoc-wrt54g did not work.

Did you see the linksys when it was in (iwconfig-set) master mode? My powerbook completely ignored the linksys when I set it to master mode via either iwconfig or "wl".

The same is true for setting a linksys into managed mode and having it associate as a client to another master-linksys. The managed linksys can see the master linksys, at least it tells one so by the correct  "Access Point:"-Field in the output of iwconfig:

 Access Point: 00:06:25:FF:77:FF

00:06:25:FF:77:FF is the mac address of the master linksys (I verified this). However pinging between client and master linksys does work either.

I couldn't even get my (second) linksys to associate with the master when using iwconfig. I would show

 Access Point: 00:00:00:00:00:00

most of the time. Sometimes this would change to the mac address of my (first) linksys for a few seconds, but then jump back to 00:00:00:00:00:00.

Strange enough, it worked when doing "wl join <first-linksys-mac>". Even "wl join <first-linksys-mac> key <wep-key>" worked, and correctly associated in encrypted mode.

Florian, was it the same for you, I mean, that associating seemed to work, but ping did not?

I never tried pinging, since it didn't even associate (using iwconfig). Using "wl join ...", ping worked.

Are you sure that you configured the correct ip-addresses & netmasks when you tried pinging? Maybe you assigned the ip only to the bridge device (br0), but not to eth2, and forgot to add eth2 to your bridge (brctl addif br0 eth2). Since this bridging stuff add another layer of complexity, I would suggest that you test this association stuff without bridging enabled. Just assign ip-addresses to the (physical) interfaces eth0, eth1, eth2 directly - and also assign the ip-address on your notebook manually, just in case it's only the dhcpserver that doesn't work, not the wireless lan.

If I have time, I'll look at the sources of wlconf to see what they do different. Seems like the only way to find out...

Until those strange issues are resolved, I suggest you configure the wlan interface via nvram variables, and just call wlconf to configure it. I use that on openwrt now (together with wl to add some wds links), and it works great.

greetings, Florian Pflug

Did you see the linksys when it was in (iwconfig-set) master mode? My powerbook completely ignored the linksys when I set it to master mode via either iwconfig or "wl".

Yes, I could see the linksys in master mode and I could also associate to it. That is how it went. I could even ping from my laptop (client) to the linksys (master).

Are you sure that you configured the correct ip-addresses & netmasks when you tried pinging? Maybe you assigned the ip only to the bridge device (br0), but not to eth2, and forgot to add eth2 to your bridge (brctl addif br0 eth2). Since this bridging stuff add another layer of complexity, I would suggest that you test this association stuff without bridging enabled. Just assign ip-addresses to the (physical) interfaces eth0, eth1, eth2 directly - and also assign the ip-address on your notebook manually, just in case it's only the dhcpserver that doesn't work, not the wireless lan.

What I did was assigning eth2 (the wireless device) with a correct IP and giving the windows laptop another IP in the same net. This way pinging worked out for client<-> master, but not for peer<->peer (ad-hoc mode)...

I'll have to look deeper into the matter to see if it is a bug by iwconfig, or my own configuration ... I mean association of the linksys always seem to work for me

Ok. Some background info:

There is an NVRAM partition that the stock partition uses to store settings, IP address, netmask, firewall settings etc. The networking.sh script parses nvram and configures the network settings.

NVRAM vars used by networking.sh:

lan_ipaddr
ip address of the "lan" side. see lan_ifname

lan_netmask
netmask in long notation (ie 255.255.255.0)

lan_proto
static, dhcp or pppoe. For the lan side this is forced as static simply due to a configuration bug in the linksys firmware that leaves the default as dhcp. pppoe support is not fully implemented.

lan_ifname
Single interface name that the lan_* variables apply to. Note that the definition of the lan side is pretty much arbitrary and does not need to reflect the actual port labels.

lan_ifnames
If lan_ifname (note the distinction) is br0 (bridge) this lists all the interfaces to be grouped in the bridge. see footnote.

- footnotes
The same pattern repeats for wan_ and also wifi_. The wifi_ prefix was just made up so we'd have somewhere to configure the wireless if we decided not to bridge ethernet and wireless under the lan heading.

Also of importance is the fact that the interface names changed between the v1.x and v2.x hardware. 1.x hid the vlan configuration in the driver and created a false eth0 and eth1, 2.x simply has an eth0 which requires vlans. Openwrt uses the 2.x ethernet drivers which means that we now have to create the vlan interfaces. The short version of this is that the networking script has a few lines to detect 1.x hardware and remap the interface names to vlans. We suggest keeping the original interface names to ease the transition between different firmwares, although the script will happily accept the vlan names.

Note the lack of firewall settings. While there is nvram variables for the firewall their format in nvram is rather restrictive, which is why OpenWrt uses a firewall.sh script in nvram instead.

Back on topic:
There are no plans to use a debian style ifup/ifdown, OpenWrt's stance is pretty much to use the nvram variables when design allows. Specifically, we will not store the above network configuration variables on jffs nor will we do an "ifup <interface>" since the settings aren't stored on a per interface basis. Modifying the networking scripts to be able to do "ifup lan" however is possible, and would be a rather minimal change.

(I should clarify that I'm speaking of the openwrt core only, if you want to do your own networking scripts feel free to)

Ok. Some background info:
There is an NVRAM partition that the stock partition uses to store settings, IP address, netmask, firewall settings etc. The networking.sh script parses nvram and configures the network settings.

I believe networking.sh only sets the lan and wan settings. For setting up the wlan device it uses linksys's wlconf - or did i misinterpret the source?

The same pattern repeats for wan_ and also wifi_. The wifi_ prefix was just made up so we'd have somewhere to configure the wireless if we decided not to bridge ethernet and wireless under the lan heading.

Did you mean to write "wlan" prefix instead of "wifi" prefix? Because this is what the stock linksys firmware uses. Or you you intend to use wifi instead of wlan for openwrt?

There are no plans to use a debian style ifup/ifdown, OpenWrt's stance is pretty much to use the nvram variables when design allows. Specifically, we will not store the above network configuration variables on jffs nor will we do an "ifup <interface>" since the settings aren't stored on a per interface basis. Modifying the networking scripts to be able to do "ifup lan" however is possible, and would be a rather minimal change.

(I should clarify that I'm speaking of the openwrt core only, if you want to do your own networking scripts feel free to)

Well, since I like the debian-style network configuration, I want to make a ifupdown ipkg - but I fully agree that this should be an optional package, and not included in the core - especially because it breaks compatibility with all other wrtg firmware versions out there. But I'm quite short on spare time at the moment, so wel'll if I ever really get to making that package

I believe networking.sh only sets the lan and wan settings. For setting up the wlan device it uses linksys's wlconf - or did i misinterpret the source?

Ok, there's two things going on:

1. wlconf sets up the wireless itself (ssid, ap mode, mac filters .. etc) using the wl_* nvram variables.
2. networking.sh sets up the device at the network (ip) level

The defaults group the lan and wireless network together under one bridge (lan_ifname=br0, lan_ifnames inclues both lan ethernet and wireless devices) and uses lan_ipaddr to set the ip address of the wireless (along with the lan as a whole).

When you go to unbridge the wireless from the ethernet you're left with lan_ipaddr being the ip address of the lan on ethernet, wan_ipaddr being your internet/wan ip address and no place to set the ip/netmask of the wireless itself. So, OpenWrt invents a set of variables wifi_ifname, wifi_ipaddr, wifi_netmask, etc. to solve the problem; these variables are really only interesting in the case where the wireless needs to be configured separately from the lan.

(There are no wlan_* variables in the linksys firmware)

Are you sure that you configured the correct ip-addresses & netmasks when you tried pinging? Maybe you assigned the ip only to the bridge device (br0), but not to eth2, and forgot to add eth2 to your bridge (brctl addif br0 eth2). Since this bridging stuff add another layer of complexity, I would suggest that you test this association stuff without bridging enabled. Just assign ip-addresses to the (physical) interfaces eth0, eth1, eth2 directly - and also assign the ip-address on your notebook manually, just in case it's only the dhcpserver that doesn't work, not the wireless lan.

Hi Florian,

AP, client and ad-hoc mode works now fine for me with b4. You were right, what I forgot to do was:

# take the wireless iface out of the bridge
brctl delif br0 eth2
# give the wireless address its own IP address
ifconfig eth2 192.168.2.1 up

After doing so and giving my other non-linksys wireless device an IP like 192.168.2.2   they could ping each other big_smile

So I could not reproduce your error...

What is a bit strange is that iwconfig is sometimes a bit reluctant when only called with a few arguments:

# this command is  sometimes ignored by the wireless iface,
# ie it stays in master or managed mode
iwconfig eth2 mode ad-hoc

# this works
iwconfig eth2 mode ad-hoc essid myNetID channel 6

Greetings from Berlin (http://www.wavelan-berlin.de)

[
What is a bit strange is that iwconfig is sometimes a bit reluctant when only called with a few arguments:

# this command is  sometimes ignored by the wireless iface,
# ie it stays in master or managed mode
iwconfig eth2 mode ad-hoc

# this works
iwconfig eth2 mode ad-hoc essid myNetID channel 6

Ok - this explains the problems a had. I never tried combining multiple commands into one iwconfig call. Thanks for your helpfull comments on this.

BTW - do you know if/how iwconfig (or iw*) can be used to establish WDS links?. I use "wl wds <mac-address>" at the moment - but I'd like to get rid of the "wl" program (It's not even included in openwrt - I copied it from a linksys running the original firmware).

greetings, Florian Pflug

Client mode works when using the "wl" binary that comes with the original linksys firmware (I copied it over to the ap running openwrt). I just need to do "wl scan", "wl scanresults", "wj join .... " and the interface goes up, and is connected to my ap.

I am running the Mar31 b4 firmware and I copied the "wl" command over from an sveasoft installation. I can't get "wl scan" to work for me. It says:

eth2: Invalid argument
scan    Initiate an active scan across all channels.
        Optional SSID argument specifies a particular SSID to scan.
        With no SSID argument, a broadcast SSID scan is performed.

Any thoughts? I'm trying to get kismet_drone working. I actually do have it working but it will not do channel hopping, which seems to be related the the "wl scan" not working. Any thoughts?

eth2: Invalid argument
scan    Initiate an active scan across all channels.
        Optional SSID argument specifies a particular SSID to scan.
        With no SSID argument, a broadcast SSID scan is performed.

the "wl scan" command only seems to work when not configured as an access point, run "wl ap 0" then "wl scan", wait a few seconds and then "wl scanresults"

the "wl scan" command only seems to work when not configured as an access point, run "wl ap 0" then "wl scan", wait a few seconds and then "wl scanresults"

It still doesn't seem to work:

~ # wl ap 0
~ # wl scan
eth2: Invalid argument
scan    Initiate an active scan across all channels.
        Optional SSID argument specifies a particular SSID to scan.
        With no SSID argument, a broadcast SSID scan is performed.

This is hardware v1.1, wonder if that has anything to do with it? I also have a v2 router and I think I might switch them around and use the v2 for openwrt, kismet, and other goodies.

the "wl scan" command only seems to work when not configured as an access point, run "wl ap 0" then "wl scan", wait a few seconds and then "wl scanresults"

It still doesn't seem to work:

~ # wl ap 0
~ # wl scan
eth2: Invalid argument
scan    Initiate an active scan across all channels.
        Optional SSID argument specifies a particular SSID to scan.
        With no SSID argument, a broadcast SSID scan is performed.

This is hardware v1.1, wonder if that has anything to do with it? I also have a v2 router and I think I might switch them around and use the v2 for openwrt, kismet, and other goodies.

Uhh, I figured out the problem. I don't even want to admit what it was. Oh well, here goes:

# ifconfig eth2 up

scans work much better when the interface is actually up, duh!  smile

I still can't seem to get channel hopping to work though:

# kismet_drone
Suid priv-dropping disabled.  This may not be secure.
No specific sources given to be enabled, all will be enabled.
Enabling channel hopping.
Disabling channel splitting.
NOTICE: Disabling channel hopping, no enabled sources are able to change channel.
Source 0 (wrt54g): Enabling monitor mode for wrt54g source interface eth2 channel 0...
Source 0 (wrt54g): Opening wrt54g source interface eth2...
Kismet Drone 2004.03.devel (Kismet)
Listening on port 3501 (protocol 8).

I had troubles setting up the wlan-interface using (purely) iwconfig. It worked in unencrypted mode, but when using wep my client (powerbook with osx) failed to recognize that the network is encrypted.

It would allow me to (sucessfully) join the network, but of course it couldn't actually exchange data, because the AP ignored the unencrypted packet emitted by the client.

When using wlconf (and the nvram-variables) to setup the interface everything worked find, and my client would prompt me for a wep-key when trying to join the network.

The solution was to modify my iwconfig call - more precisly to put the wep-settings BEFORE the essid. I analyzed the wlconf and the iwconfig source - looks like iwconfig processes the argument in the same order as they are written on the command line. wlconf always follows the same order, and basically
.) Unsets the essid (According to the comment to detach from any accesspoint if in client mode)
.) Sets the channel
.) Sets the mode (master, client, ...)
.) Sets the security settings
.) Configures the essid.

Seems like the wlan-driver (partially) depends on this order - after rearranging the order of the iwconfig arguments to reflect the order used by wlconf, things suddenly worked.

These are the commands I use to bring up the wireless interface, and so far things seem to work properly.

ifconfig eth2 up
iwconfig eth2
        channel 6
        mode master
        key <wep-key> restricted
        essid <essid>

If someone knows how to configure WDS-links without using the (closed-source) "wl" app (not included in openwrt, but in the original linksys firmware), I'd like to hear it.

If someone knows how to configure WDS-links without using the (closed-source) "wl" app (not included in openwrt, but in the original linksys firmware), I'd like to hear it.

Well, i am sure thats not exactly what you want to hear, but since i am having a 1.0 version HW i could change the broadcom mini pci wlan card to a prism based one, and so i can run hostap and bypass all those disadvantages derived from the binary only driver. And wds is also able to be set with the hostap-utils. At least, there is something good having a 1.0 HW.

Cheers,
Nils

If someone knows how to configure WDS-links without using the (closed-source) "wl" app (not included in openwrt, but in the original linksys firmware), I'd like to hear it.

wlconf will configure wds at bootup based on the variables wl0_wds and wl0_lazywds.

wlconf will configure wds at bootup based on the variables wl0_wds and wl0_lazywds.

Is anyone working on a program (non-nv-variable based) that is able to adjust those settings that are at the moment only available through wlconf (and wl, but that doesn't count since it's binary-only, and not part of openwrt), but not through iwconfig

If not, I'll put it on my TODO-List of Things-Todo-If-I-should-find-myself-being-bored-one-day (So, don't hold your breath for it) wink)

can anyone please tell me that how can we integrate hwsim in openwrt images.
i tried to include kmod_mac80211 but in that build i am not able to see the integrated hwsim.
even it is not taking the command iwconfig.?
please help me

The discussion might have continued from here.