# madwifi - not starting on correct channel (RESOLVED)

## Akaihiryuu

I'm using an Atheros card as an access point...I have everything set up in /etc/conf.d/net (including channel 11).  However, when ath0 is started at boot, it starts on channel 1 or 2.  I have to do an ath0 restart to make it go to 11.  I can't figure out why it's not starting on the correct channel on boot, it should be using the same config file and doing the same thing.  Has anyone else run into this?Last edited by Akaihiryuu on Tue Jul 17, 2007 11:14 pm; edited 2 times in total

----------

## no_hope

I've experienced Atheros cards ignoring the channel setting if it was set before the interface is up. I.e. "iwconfig ath0 channel 11; ifconfig ath0 up" fails, "if config ath0 up; iwconfig ath0 channel 11" works.

Maybe you could add something to set the channel in preassociate()

----------

## Akaihiryuu

That has to be the problem...how would I change that?  I assume it would be editing a script or config file somewhere...

----------

## no_hope

At the very end /etc/conf.d/wireless.example shows how you could run custom scrips in preassociate function which you could define in /etc/conf.d/net. Maybe you could bring the interface up and set the channel there.

----------

## Paris Heng

Recently there has been a problem discovered with certain cards made by these manufacturers. There is no resolution from the manufacturers as of yet.

Who is affected:

Certain 802.11a/b/g client cards that utilize a Dual Radio Atheros Integrated Circuit Design. Cards that have been identified with the problem include:

    Cisco AIR-CB21AG-A-K9

    D-Link DWL-AG650 (HW Rev 3)

    Linksys WPC-55AG V1.1

    Netgear WAG511 V2

    Nortel MU2202

    SMC 2336W-AG

***Note this impacts many 802.11 a/b/g combination cards not 802.11 b/g or 802.11a cards.

Problem Symptoms:

Users whose hardware is affected by this problem will experience degraded connectivity (Signal Strength / Throughput) when associated to an Access Point (AP) operating on Channel 11. There is no issue when associated to AP's operating on Channels 1 and 6.

There is an approximate 50% reduction in data throughput and available bandwidth on Channel 11 (and 10) compared to other 802.11 b/g Channels (1- :Cool: . Note: Channel 9 is marginal based on our testing.

The effective range, when using the affected cards, is significantly reduced and varies by the type of building / RF environment.

Since the design of wireless networks requires the predominate use of channels 1, 6, and 11, it can be assumed that a significant percentage of wireless areas on campus and elsewhere use Channel 11.

This means if you are using an affected card in a wireless area being supported by an AP using Channel 11, you may experience a significant reduction in the speed of your connection. If you are trying to access the network in the outer area(s) of coverage, you may not be able to connect.

Reference: http://oit.utk.edu/helpdesk/faq.php?section=11

----------

## Akaihiryuu

I'm not experiencing any connectivity issues...the only problem is it ignores my channel setting when the interface is first brought up on boot.  Subsequent restarts of the interface puts it on the correct channel.  If the previous poster is correct, all I need to do is put something in preassociate that will bring the interface up (ifconfig ath0 up) before doing any wireless configuration.  Any idea how I would do this?  This is configuration on the access point itself, not the client.  Everything *works* as is, I just don't want it on the default channel (seems to be either 1 or 2) because the defaults seem to be really overused.

----------

## gentoonewb39

I have had (and continues to have) the same problem as the original poster. The problem does not a appear when using windows so it does not appear to be a hardware problem, my card is a DWL-G520 and so far what I have tried is

switching channels on my AP 

upgraded every pice of software on my computer (I have had this error probaly for more then six months)

switching antennas

and a bunch of other stuff

----------

## Akaihiryuu

The problem is...the driver is ignoring the channel setting if the interface isn't already up when iwconfig is called upon to change the channel.  A simple ifconfig ath0 up in the scripts before starting the driver would fix it, but I don't know how to do it.  There is a preassociate() option listed in wireless.example but I don't know how to use it.  My issue only happens when putting the card into master (access point) mode on boot.  An /etc/init.d/net.ath0 restart fixes it and puts it on the correct channel every time.

----------

## Monkeh

```
preup() {

      if [[ ${IFACE} == ath0 ]]; then

      ifconfig $IFACE up

      fi

}
```

Not sure why you have this problem though, I've been using Atheros cards as APs for a while without such issues.

----------

## Akaihiryuu

Added that, it does run the preup function before bringing the interface up, but it's still doing the same thing.  On bootup (and only on bootup), it *tells* me it's starting on channel 2 (even though conf.d/net says 11 for that interface) but actually starts it on channel 1.  If I do /etc/init.d/net.ath0 restart, it starts it on channel 11 properly.  This makes absolutely no sense...it has to be a problem with the net scripts but I have no idea where the problem could be.  I'd really like to be able to have my server start up on its own without having to type in several console commands.

----------

## pdr

I have the same problem in my laptop. I tried adding

```
iwconfig ath0 channel 1
```

in my postassociate(), but it does not work. Some kind of delay is required - but I tried

```
sleep 10

iwconfig ath0 channel 1
```

and it still would not change.

I'm waiting for a driver fix. In the meantime I start the interface manually via the initscript, wait a little while, and manually use iwconfig to set the channel.

----------

## Akaihiryuu

That's a good point.  I was stopping/starting the interface to get it to channel 11 where I wanted it.  It didn't occur to me to just iwconfig ath0 channel 11.  I could just add that command to /etc/conf.d/local.start and that'd make sure it got set properly until the driver gets fixed.

Edit: I've also been messing around trying to find a way to get net.br0 to start automatically at the correct time, finally did so by adding it to boot runlevel and removing the depend eth0/ath0 entry for br0 from conf.d/net.  The last time I booted after making this change, ath0 started on channel 11 right away, and it continues to do so.  I don't know what I did that fixed it (if anything), perhaps it was because another interface (br0) was already up before ath0 started.

----------

## JeanValjean

Thanks this worked for me!  Adding net.ath0 to boot actually adds it to both the debault and boot level, and hence then works.  I created a boot script the called ifconfig up before the net script and it the same error returned.  So this is a problem of the net.* script itself that actually brings down ifconfig for some unknown reason.

----------

## richard.scott

Hi,

Did anyone ever find a fix for this. I've not been able to get the "preup" suggestion to work   :Embarassed: 

I've been using madwifi-ng as an AP for a while and not had this problem before!

Perhaps this is fixed in a newer 0.9.3.3 release of the madwifi-ng drivers but as I'm unable to get my system to boot as an AP with it I'm unable to test. I get as far as "INIT: version 2.8.6 booting" and it hangs my system. The cursor stops flashing and it all stops   :Shocked: 

Cheers,

Rich.

----------

