# Unable to associate with WEP key.. now DHCPcd problems

## RedScull

Sorry to load up with another ipw2100 problem, I've perused the other threads, and none of them helped.

Without a WEP key, /etc/init.d/net.eth1 start works fine, but I can't seem to associate my laptop with my gentoo AP when there's a WEP key defined. At least not automagically with init.d.

```
iwconfig eth1 essid "Solid Gold Babies" key "s:any13characte" enc open mode Managed channel 7

dhcpcd eth1
```

These commands work, and allow me to associate, but I'd like to be able to just use init.d to associate.

With no WEP:

```
(none) linux # /etc/init.d/net.eth1 start

 * Starting eth1

 *   Configuring wireless network for eth1

 *     eth1 connected to "Solid Gold Babies" at 00:0F:B5:82:61:5B

 *     in managed mode on channel 7 (WEP disabled)

 *   Configuration not set for eth1 - assuming dhcp

 *   Bringing up eth1

 *     dhcp

 *       Running dhcpcd ...                                                 [ ok ]

 *       eth1 received address 192.168.0.60/24
```

With WEP:

```
(none) linux # /etc/init.d/net.eth1 start

 * Starting eth1

 *   Configuring wireless network for eth1

 *   Failed to configure wireless for eth1                                  [ !! ]
```

/etc/conf.d/net & /etc/conf.d/wireless (relevant bits)

```
modules_ath0=( "iwconfig" )

essid_eth1="any"

mode_eth1="Managed"

channel_eth1="7"

preferred_aps_eth1=( "Solid Gold Babies" )

key_Solid_Gold_Babies="s:any13charate enc open"

config_Solid_Gold_Babies=( "dhcp" )

#dhcpcd_Solid_Gold_Babies="-t 5"

routes_Solid_Gold_Babies=( eth1/192.168.0.1 )

#mac_key_000FB582615B="s:any13characte enc open"

#mac_config_000FB582615B=( "dhcp" )

#mac_dhcpcd_000FB582615B="-t 5"

#mac_dns_servers_000FB582615B=( "192.168.0.1" )

adhoc_essid_eth1="NetworkDown"

config_NetworkDown=( "192.168.0.2 netmask 255.255.255.0" )

routes_NetworkDown=( eth1/192.168.0.1 )
```

I can provide the config files for the AP too, but everything works for my housemate's windows laptop, so I doubt that's the problem.

I'm using the latest ~x86 builds of wireless-tools, baselayout, dhcpcd, and ipw2100. (Though it didn't work with the stable builds either)

Thanks for the help.Last edited by RedScull on Sun Oct 23, 2005 9:13 am; edited 1 time in total

----------

## dgaffuri

Try to remove anything from conf files except for dhcp and WEP key.

```
# grep -v '^#\|^$' /etc/conf.d/net

config_eth1=( "dhcp" )

# grep -v '^#\|^$' /etc/conf.d/wireless

key_<my ESSID>="s:'<my WEP key as a string>'"
```

Note that if your WEP key contains spaces or other special chars you have to enclose it in single quotes.

----------

## butters

I have the same problem.  I haven't tried without WEP because it's not my AP, and the admin won't disable the WEP.  Same deal:

/etc/init.d/net.eth1 start

fails trying to get a dhcp address.

iwconfig eth1

shows that neither my essid nor my WEP key are set, even though I set them in /etc/conf.d/wireless

iwconfig eth1 essid <id> key <wep_key>

/etc/init.d/net.eth1 start

works perfectly fine.  This makes no sense and seems like a bug in the initscript.

----------

## dgaffuri

Which version of baselayout do you have? May you post significative lines from net & wireless conf files?

----------

## butters

 *dgaffuri wrote:*   

> Which version of baselayout do you have? May you post significative lines from net & wireless conf files?

 

baselayout = 1.12.0_pre8-r2 (not the most current but close)

config_eth1="dhcp"

dhcpcd_eth1="-N -t 30"

essid_eth1="B"

mode_eth1="auto"

channel_eth1="3"

key_B="DC34-2846-2F enc open"

----------

## butters

Sometimes on a reboot I will associate with the neighbor's AP, which doesn't have WEP enabled, but filters by MAC address.  I also found that simply specifying the key is enough to associate with the right AP.  I don't even need the essid if I specify the key.  All I really need from /etc/conf.d/wireless is to set the WEP key, and it can't even do that correctly.

----------

## dgaffuri

 *butters wrote:*   

> baselayout = 1.12.0_pre8-r2 (not the most current but close)

 

Mine is 1.11.13-r, and is working good.

If I understood well the init script will not work on boot _and_ if you invoke it manually. If so you may want to try yo debug the script running

```
NET_DEBUG=y /etc/init.d/net.eth1 start
```

Maybe you will find that the iwconfig command is not executed or have different parameters from yor manual invocation.

----------

## butters

 *dgaffuri wrote:*   

> If I understood well the init script will not work on boot _and_ if you invoke it manually.

 

I don't see why this would be the case.  The init system should be robust enough to handle arbitrarily restarting initscripts even if they were first invoked by init/telinit/rc.

As it stands this is just a stupid annoyance, because once I manually set the key, I can bring the interface up and down as I please until I next reboot.  I'll try the NET_DEBUG variable the next time I reboot.  Is there a whole system like this for debugging various initscripts that I don't know about?  Can I do:

HALD_DEBUG=y /etc/init.d/hald start

or something similar?  Anyways, if net.ethX isn't sourcing /etc/conf.d/wireless and invoking iwconfig when starting my ipw2100 interface, then I don't know what else I can do... besides putting the iwconfig command in local.start and making net.eth1 start after local.

----------

## dgaffuri

 *butters wrote:*   

>  *dgaffuri wrote:*   If I understood well the init script will not work on boot _and_ if you invoke it manually. 
> 
> I don't see why this would be the case.  The init system should be robust enough to handle arbitrarily restarting initscripts even if they were first invoked by init/telinit/rc.

 

Sorry, I think there's been a misunderstanding. I was only asking if the script fails in both cases, I was not asserting anything at all.

 *butters wrote:*   

> Is there a whole system like this for debugging various initscripts that I don't know about? Can I do: 
> 
> HALD_DEBUG=y /etc/init.d/hald start

 

Really don't know, I found it looking in the net.lo script itself when I had network startup problems.

----------

## butters

 *dgaffuri wrote:*   

> If I understood well the init script will not work on boot _and_ if you invoke it manually.

 

 *dgaffuri wrote:*   

> 
> 
> Sorry, I think there's been a misunderstanding. I was only asking if the script fails in both cases, I was not asserting anything at all.

 

Ah, I see now.  I read that statement about 8 times trying to understand what you meant, and I chose the wrong interpretation.  I should have said: "correct, it fails whenever the script runs, either at boot or afterwards."

In hindsight, it might have been more clear to write "If I understood you well..." because my mind assumed the direct object to be "it" (as in the documentation or some other 3rd-party) by default.  I'm not trying to be a grammar nazi or anything, just trying to help, you being one of those incredibly prolific post-answerers for whom the forums are eternally thankful.  My join date and post count tell a completely different story...

----------

## RedScull

Okay it all works now, except dhcp (this is the case with eth0 as well. I don't know what's happened). The init script tries to run dhcpcd, and it times out. If I do it manually, it times out also. Interestingly though, it retrieves an address if I type the command: 

```
iwconfig eth1 essid "Solid Gold Babies" mode "Managed" key "s:any13characte" enc open | dhcpcd eth1
```

In regards to the above problem, for whatever reason, the key had to be in single quotes, even though there are only alphanumeric keys in it. So instead of this: 

```
key_essid="s:any13characte"
```

 ...I have... 

```
key_essid="s:'any13characte'"
```

 Also, the setting essid_eth1="any" seemed to screw it up. Maybe I'm using a deprecated version of something? I'm on baselayout v1.12.0_pre8-r2 (latest stable) and dhcpcd v2.0.0.

I'm re-emerging dhcpcd to see if that fixes it.

[edit]Nope. Still timing out.[/edit]

----------

