# Wireless Wont Go Up automatically

## Hiltz

I have an atheros wifi card and i have my net config file setup perfectly but whenever i try to run it it says:

```
 * Starting ath0

 *   Configuring wireless network for ath0

 *     no access points found

 *   Couldn't find any access points on ath0

 *   Failed to configure wireless for ath0                                [ !! ]

tuxbox init.d # ifconfig ath0 up

tuxbox init.d # rc

 * Starting ath0

 *   Configuring wireless network for ath0

 *     ath0 connected to "wireless1" at 00:12:17:F0:02:D4

 *     in managed mode (WEP enabled - open)

 *   Bringing up ath0

 *     dhcp

 *       Running dhcpcd ...                                               [ ok ]

 *       ath0 received address 192.168.0.12

```

Now if i up the interface it will work fine.. but i have to do it manually.. 

Does anyone know how i can make the script auto up the wireless card?

Here is my net file:

```

modules=( "iwconfig" )

modules=( "ifconfig" )

key_wireless1="****************** enc open"

preferred_aps=( "wireless1" )

config_wireless1=( "dhcp" )

fallback_wireless1=( "192.168.0.12/24" )

fallback_route_wireless1=( "default via 192.168.0.1" )

```

----------

## imrambi

Move the following into /etc/conf.d/wireless

```
key_wireless1="****************** enc open"

preferred_aps=( "wireless1" ) 
```

Then have you net look like:

```
config_wireless1=( "dhcp" )

fallback_wireless1=( "192.168.0.12/24" )

fallback_route_wireless1=( "default via 192.168.0.1" ) 
```

This setup works for me, my card comes on at boot. It might be looking at the wireless conf file at boot. If this doesn't work whats the output of dmesg and whats the last 30 lines of /var/log/messages

----------

## Hiltz

nope it still doesnt bring the wireless up.. its very odd.. any other ideas?

----------

## Logge

I'm having a similar problem since this morning. I voke up, turned my laptop on and found that the wireless didn't work. How come I wonder... I cant do anything with the wireless. Cant make it connect to an AP.

Since a few hours I have been working on getting this to work. I have been installing, reinstalling etc... Been taking a look on both /etc/conf.d/net and wireless. I cant make it work again but I just cant figure out why...

Any ideas??

//Logge

----------

## Logge

 *Hiltz wrote:*   

> nope it still doesnt bring the wireless up.. its very odd.. any other ideas?

 

I made this to get my card working again:

* got essid_wlan0 looking like essid_wlan0="any"

* Commented out the lines about fallback for the essid

* Added associate_order="forceany" after preferred_aps()

That made my card work and got me really happy again...

//Logge

----------

## Hiltz

Nope it still doesnt work.. I still have to manually put the interface up before the rc script will work

----------

## Logge

Have You done a symbolic link to net.lo  from net.ath0 in Your  /etc/init.d/ ??

```
# ln -s net.lo net.ath0

# rc-update add net.ath0 default

```

then try

```
# /etc/init.d/net.ath0 start

```

----------

## rojanu

Well I used to get 

```
# /etc/init.d/net.eth1 start

 * Starting eth1

 *   Configuring wireless network for eth1

 *     no access points found

 *   Couldn't find any access points on eth1

 *   Failed to configure wireless for eth
```

but after I did *Quote:*   

> * got essid_wlan0 looking like essid_wlan0="any"
> 
> * Commented out the lines about fallback for the essid
> 
> * Added associate_order="forceany" after preferred_aps() 

 

now I get

```
# /etc/init.d/net.eth1 start

 * Caching service dependencies ...                                                                                                                            [ ok ]

 * Starting eth1

 *   Configuring wireless network for eth1

 *   Trying to force preferred in case they are hidden

Error for wireless request "Set Encode" (8B2A) :

    SET failed on device eth1 ; Argument list too long.

 *   eth1 does not support setting keys

 *   or the parameter "mac_key_renas" or "key_renas" i
```

```

```

# cat /etc/conf.d/net

config_eth0=( "dhcp" )

dhcp_eth0="nodns nontp nonis"[/code]

```

modules=( "iwconfig" )

essid_eth1="any"

key_renas="[1] s:DFBE006CA96A0E11EFD10CB6FA [1] enc open"

key_ESSID2="[1] aaaa-bbbb-cccc-dd key [1] enc restricted"

preferred_aps=( "renas" "ESSID2" )

associate_order="forceany"
```

Any ideas

----------

## Logge

What's the output if You comment out the line about 'associate_order="forceany"'??

//Logge

----------

## rojanu

I get the same output

----------

## Logge

Do You see this:

```
key_renas="[1] s:DFBE006CA96A0E11EFD10CB6FA [1] enc open" 

 key_ESSID2="[1] aaaa-bbbb-cccc-dd key [1] enc restricted"
```

Change that to:

```
key_renas="s:DFBE006CA96A0E11EFD10CB6FA enc open" 

 key_ESSID2="aaaa-bbbb-cccc-dd key enc restricted"
```

Try that and give us the output... I think that's what's wrong... =)

//Logge

----------

## rojanu

What I got  was 

```
 # /etc/init.d/net.eth1 start

 * Caching service dependencies ...                                                                                                                            [ ok ]

 * Starting eth1

 *   Configuring wireless network for eth1

 *   Trying to force preferred in case they are hidden

Error for wireless request "Set Encode" (8B2A) :

    SET failed on device eth1 ; Argument list too long.

 *   eth1 does not support setting keys

 *   or the parameter "mac_key_renas" or "key_renas" is incorrect

Error for wireless request "Set Encode" (8B2A) :

    invalid argument "enc".

 *   eth1 does not support setting keys

 *   or the parameter "mac_key_ESSID2" or "key_ESSID2" is incorrect

 *   Failed to associate with any preferred access points on eth1

 *   Failed to configure wireless for eth1
```

then I removed essid2

and what I get is 

```
 # /etc/init.d/net.eth1 start

 * Caching service dependencies ...                                                                                                                            [ ok ]

 * Starting eth1

 *   Configuring wireless network for eth1

 *   Trying to force preferred in case they are hidden

Error for wireless request "Set Encode" (8B2A) :

    SET failed on device eth1 ; Argument list too long.

 *   eth1 does not support setting keys

 *   or the parameter "mac_key_renas" or "key_renas" is incorrect

 *   Failed to associate with any preferred access points on eth1

 *   Failed to configure wireless for eth1
```

----------

## Logge

What kind of wifi-card do you have and what driver do You use??

//Logge

----------

## rojanu

My card is Airport and use kernel built-in drivers for it

----------

## Logge

what does:

```
# iwlist eth1 scan
```

tell you??

----------

## rojanu

```
# iwlist eth1 scan

eth1      Interface doesn't support scanning : Network is down
```

----------

## Logge

which probably means that your card dont work with that driver you have... Is everything enabled in the Kernel that have to be enabled??

//Logge

----------

## rojanu

According to the PPC FAQ thats all I have to do

----------

## Logge

Oh... So you are on Apple hardware.... That is beyond my knowledge, i'm sorry.

Have You been having that card working under gentoo before??

----------

## rojanu

Sorted the problem of not connecting to the AP however now what I get is

```
i # /etc/init.d/net.eth1 restart

 * Caching service dependencies ...                                                                                                                            [ ok ]

 * Stopping eth1

 *   Bringing down eth1

 *     Shutting down eth1 ...                                                                                                                                  [ ok ]

 * Starting eth1

 *   Configuring wireless network for eth1

 *   Trying to force preferred in case they are hidden

 *     eth1 connected to "renas" at 00:0C:41:9B:32:3E

 *     in managed mode on channel 11 (WEP enabled - open)

 *   Configuration not set for eth1 - assuming DHCP

 *   Bringing up eth1

 *     dhcp

 *       Running dhcpcd ...                                                                                                                                    [ !! ]

```

so it fails to get an IP address I have tried setting the IP manuall to no avail

```
# iwlist eth1 scan

eth1      Scan completed :

          Cell 01 - Address: 00:0C:41:9B:32:3E

                    ESSID:"renas"

                    Mode:Master

                    Frequency=2.462 GHz (Channel 11)

                    Signal level:-39 dBm  Noise level:-102 dBm

                    Encryption key:on

```

----------

## Logge

That is probably because there haven't been any key set to the interface, used to open the door for you to retrieve an IP from the dhcp.

Now You know that it works to connect to the ap. Try finding a way to set the key since the ap requiers one.

What kernel-version are you running by the way??

//Logge

----------

## Bombs14

I'm getting this same problem with the newest madwifi drivers in portage:

madwifi-driver-0.1443.20060207

I didn't use to have to bring up the interface with ifconfig before this version...not sure what got changed.

----------

## rojanu

 *Logge wrote:*   

> That is probably because there haven't been any key set to the interface, used to open the door for you to retrieve an IP from the dhcp.
> 
> Now You know that it works to connect to the ap. Try finding a way to set the key since the ap requiers one.
> 
> What kernel-version are you running by the way??
> ...

 Well  key if you mean WEP key I have already set that and I don't know any other keys

I have tried without a WEP key but after sometime it disconnects however I think that might be connected to power saving settings as my screen gets darker after very short idle time.

kernel

```
# emerge -s gentoo-sources

Searching...

[ Results for search key : gentoo-sources ]

[ Applications found : 1 ]

*  sys-kernel/gentoo-sources

      Latest version available: 2.6.15-r7

      Latest version installed: 2.6.15-r7

```

----------

## Logge

What I understand is that You have found a satifying way to manage the connection to the AP, right?

What happens if you turn off the options about power saving on the AP?

//Logge

----------

## rojanu

OK, so far I can connect connect to my AP now using either KWifiRadar or Wifi radar programs.

With KWifiRadar I have to open Config with root rights and click on activate the config and can connect just fine and

with Wifi radar have to choose my AP from list and hit connect button to connect. However manullay starting the 

```
/etc/init.d/net.eth1 start
```

 does not start.

I mean, I can start manualluy but I want is to be able to connect to my AP by default and/or connect to any AP which have no security enabled.

----------

## qpmarl

I was having a very similar problem with the madwifi drivers for my atheros card.  After an update, the automatic scripts wouldn't work, but I could manually bring the network up with ifconfig.

After a lot of messing around with the startup scripts (preup function, etc) and playing with iwconfig, I traced the problem to iwconfig.  If I would do 

```
ifconfig ath0 up
```

, then it would work fine, but nothing with iwconfig would work - if I did 

```
iwconfig ath0 essid mynetwork
```

 it would show the essid as being mynetwork, but the signal strength would be 0 and the mac of the ap would be all 0's.

I switched to wpa_supplicant and it's been working fine since.

----------

