# Help using WEP with wireless 802.11g [SOLVED]

## l8nite

I'm not able to receive a dhcp lease / ping out when I have WEP enabled on my router/wireless card.  With WEP disabled, it works fine.

 *Quote:*   

> Card: D-Link DWL-G520
> 
> Chipset: Atheros
> 
> AP: Linksys Wireless Router WRT54G (firmware v2.02.7)

 

I rebuilt my kernel with CONFIG_NET_RADIO and CONFIG_NET_WIRELESS set to Y, installed the 'madwifi' drivers for the atheros chipset, and loaded the modules 'wlan', 'ath_hal', and 'ath_pci' in that order.

Here's what iwconfig said at this point:

```
lo        no wireless extensions.

eth0      no wireless extensions.

ath0      IEEE 802.11  ESSID:""

          Mode:Managed  Frequency:2.412GHz  Access Point: 00:00:00:00:00:00

          Bit Rate:0kb/s   Tx-Power:off   Sensitivity=0/3

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:off

          Link Quality=0/94  Signal level=-95 dBm  Noise level=-95 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
```

And in dmesg I got 

```
Jul 26 21:56:32 [kernel] ath_pci: 0.8.5.5 BETA

Jul 26 21:56:32 [kernel] Setup queue (0) for WME_AC_BK

Jul 26 21:56:32 [kernel] Setup queue (1) for WME_AC_BE

Jul 26 21:56:32 [kernel] Setup queue (2) for WME_AC_VI

Jul 26 21:56:32 [kernel] Setup queue (3) for WME_AC_VO

Jul 26 21:56:32 [kernel] ath0: 802.11 address: 00:ff:dd:aa:55:dd

Jul 26 21:56:32 [kernel] ath0: Atheros 5212: mem=0xd5000000, irq=4
```

So far so good, everything seems to have been detected and is ready to start working.  I emerged the wireless-config utility to allow easy setup of the configuration through /etc/conf.d/wireless.  Here's what my configuration looks like:

```
key_APTR204="12340000123400001234000012 enc open"

preferred_aps=( "APTR204" )
```

I also added this to /etc/conf.d/net:

```
ifconfig_ath0=( "dhcp" )

dhcpcd_ath0="-t 10 -h `cat /etc/hostname`"
```

Then I symlinked /etc/init.d/net.ath0 to /etc/init.d/net.eth0 and ran:

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

 * Running preup function

 *   Configuring wireless network for ath0

 *   Scanning for access points

 *     Found "APTR204" at 00:AA:BB:CC:DD:EE (WEP required)

 *     Found "linksys" at 00:55:22:FF:DD:EE (WEP required)

 *     Found "Bubbles" at 00:99:BB:FF:CC:44 (WEP required)

 *     Found "trapeze" at 20:20:AA:AA:CC:EE (WEP required)

 *   Connecting to "APTR204" (WEP enabled)...                             [ ok ]

 *     ath0 connected to "APTR204" in managed mode

 *     on channel 04 (WEP enabled)

 * Bringing ath0 up...

 *   ath0 dhcp                                                            [ !! ]
```

And finally, this is what iwconfig looks like after all this is done:

```
ath0      IEEE 802.11  ESSID:"APTR204"

          Mode:Managed  Frequency:2.427GHz  Access Point: 00:AA:BB:CC:DD:EE

          Bit Rate:36Mb/s   Tx-Power:50 dBm   Sensitivity=0/3

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:1234-0000-1234-0000-1234-0000-12 Security mode:open

          Power Management:off

          Link Quality=21/94  Signal level=-74 dBm  Noise level=-95 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
```

Am I missing some fundamental step here?  I've triple-checked the keys and made sure the router was operating in WEP mode ( 128 bits, 26 hex digit keys)

To re-iterate; With WEP disabled the card works fine, so I assume the problem has to do with the setting of the key and/or connecting with it.

Thanks for any advice you might have,

Shaun

----------

## l8nite

Following the advice of the guy at the end of this topic: https://forums.gentoo.org/viewtopic.php?t=189946

I changed my linksys' default transmittal key to be the first one, and then updated my /etc/conf.d/wireless settings to match and voila!

[/url]

----------

## UberLord

You can set multiple keys and set active key on the keys_ESSID= command - there should be no reason to change the Access Point

----------

## timeout

i had same problem with wireless-config package. It works fine without WEP. I only be able to make it work manually like following:

```

iwconfig wlan0 essid "myessid"

iwconfig wlan0 key "s:linux open"

ifconfig wlan0 up

dhcpcd -d wlan0

```

----------

