# dhcp fails on boot... wireless [solved]

## gmtongar

Hi!

I'm in desperat need of an advice here.   :Rolling Eyes: 

During boot my wireless tries to connect to my AP, but it fails, the error is something like:

```
Failed to connect to any wireless access points
```

But after login it's enough to run dhcpcd ath0, and I'm all set, up and running. This is how my /conf.d/net looks like:

```
modules=("iwconfig")

channel_ath0="11"

key_myESSID="[1] my_hex_key [1] enc open"

preferredonly=("myESSID")

#preferred_aps=("myESSID")

blacklist_aps=("NeighboursESSID1" "NeighboursESSID2")

config_ath0=("dhcp")
```

and when I, after login runs: iwconfig

```

ath0      IEEE 802.11g  ESSID:"myESSID"

          Mode:Managed  Frequency:2.462 GHz  Access Point: 00:0F:B5:22:D0:88

          Bit Rate:11 Mb/s   Tx-Power:18 dBm   Sensitivity=0/3

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:my_hex_key   Security mode:open

          Power Management:off

          Link Quality=28/94  Signal level=-67 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

```

The thing is my wireless gets associated correctly, but it doesn't get the dhcp request completed, it seems to me.

Anyone who can tip me on this_

thanks

gmtongar

----------

## Gentoo Bob

Are you using WPA or WEP?

----------

## gmtongar

Hi Gentoo bob

I'm using WEP

----------

## Gentoo Bob

trying doing this since your using WEP...create a script.

#!/bin/bash

modprobe (your module here, if you are using ndiswrapper, put ndiswrapper here)

iwconfig ath0 mode Managed

iwconfig ath0 key open (your key here)

iwconfig ath0 essid (your essid here)

dhcpcd ath0

save that file.  

do a chmod +x (your file name here)

then at the command prompt type:  ./(your file name)

Try that.

----------

## gmtongar

Yes, I know, I ran that script before, but I think I am so close, it ought to work the plain and simple way. I just don't understand why it doesn't work. Works fine on a DELL laptop (Intel PRO Wireless 3945), but not with madwifi (not the same card, or machine). 

I've used the script, but this time around I was hoping to do without...   :Mad: 

gmtongar

----------

## martinm1000

if you updated yesterday dhcpcd version 3, downgrade to the previous version 2.

dhcpcd 3 doesn't work.

https://forums.gentoo.org/viewtopic-t-520236-start-0-postdays-0-postorder-asc-highlight-dhcpcd.html

----------

## martinm1000

And they call it a version 3.0.0  :Wink: 

https://bugs.gentoo.org/show_bug.cgi?id=156515

Downgrading to version 2 works.

----------

## gmtongar

Hi martinm

Just checked, I'm using v. 2.0.5

dhcp works, just not during boot configuring my wireless nic, dhcp works for my wired nic. After login it's enough to do dhcpcd ath0, and I got an IP.

Aaaaarrghhh! This pisses me off. Maybe I just have to bite the dust. Can't get it all, it seems.

gmtongar

----------

## wynn

There's another thread here which might be helpful.

It has a post which points to a third thread...

----------

## gmtongar

Yes, that patch would be something... but the link to bugzilla turns out bad (dead or moved).

----------

## wynn

The URI has a typo, it should be https://bugs.gentoo.org/show_bug.cgi?id=143698, it had a "." added on after the final 8   :Smile: 

----------

## gmtongar

Sorry, missed that one...   :Embarassed: 

----------

## gmtongar

Yes, wynn, that patch looks just right for me, I really think that one would be quite usefull.   :Rolling Eyes:  Yes, I can definetly see that patch as something very, very interesting, and actually the thing that we have been looking for.

Dare I be that bold, mr wynn, to come out straight forward and plea for some advice on how to use that patch, in a certain newbie kind of way?   :Rolling Eyes: 

Anyhow, thanks for pointing me the direction thus far...   :Wink: 

gmtongar

----------

## wynn

I'll have another look at the patch â I seem to remember that there was more than one.

Unfortunately that "look" will have to wait, there is a database error message on bugs.gentoo.org at the moment.

----------

## gmtongar

 *Quote:*   

> I'll have another look at the patch â I seem to remember that there was more than one. 
> 
> Unfortunately that "look" will have to wait, there is a database error message on bugs.gentoo.org at the moment.

 

Great!

Thanks, mate

This is my "last" problem, part from this Gentoo now runs just perfect, at least as far as I can tell. 

gmtongar

----------

## wynn

If you were thinking of the "if_down_up_hack.patch" then all you have to do is to open /lib/rcscripts/net/iwconfig.sh in nano, search (^W) for "scanning" and you will be at this point

```
        done < <(iwlist "${iface}" scan 2>/dev/null)

        if ${error}; then

                ewarn "${iface} does not support scanning"
```

To add the patch, go to the blank line before "if ${error};" and add

```
       # HUP the interface as some drivers/cards need it

       interface_down ${iface}

       interface_up ${iface}
```

Is that what you wanted?

----------

## gmtongar

Wow! Thanks, mate, it's working... it's working! The bloody thing is working! Finally. 

Thanks, wynn. The plain and simple, just fantastic!

----------

## wynn

I'm glad you've got it working.

Time to change to wpa_supplicant now, isn't it?   :Very Happy: 

----------

## UberLord

 *gmtongar wrote:*   

> The plain and simple, just fantastic!

 

And also causes major grief with other wireless drivers, so that madwifi only "fix" was removed.

But as I think about it, it may also have been caused by a long standing issue with dhcpcd. Basically versions 1 and 2 only sent 1 discover packet by default. So if it got lost over the wireless then tought.

With dhcpcd-3 we have a better approach were we re-send the request if we don't receive a valid DHCP packet every 3 seconds.

However, that had a new bug where we stopped listening after the first re-send - lol.

Anyway, I think all dhcpcd issues are now solved, so why not try out this tarball with the up/down hack removed.

http://dev.gentoo.org/~uberlord/dhcpcd-3.0.2_pre1.tar.bz2

Thanks for testing and getting back to me  :Wink: 

----------

