# wpa_supplicant don't give IP (nor via dhcp nor static)

## firepol

Hi,

I have a laptop with 2 linux installations. Ubuntu and Gentoo. With ubuntu I can make my wireless card work.

With ubuntu the configuration wad reletively easy. That's the file I had in my ubuntu box under /etc/network/interfaces:

 *Quote:*   

> 
> 
> # This file describes the network interfaces available on your system
> 
> # and how to activate them. For more information, see interfaces(5).
> ...

 

Under ubuntu by issuing /etc/init.d/networking restart I could have wireless and wired working.

I have a Broadcom wireless card. From lspci: *Quote:*   

> 
> 
> 06:05.0 Network controller: Broadcom Corporation BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller (rev 02)

 

Now, coming back to Gentoo...

I followed this Gentoo Wireless Networking Howto. I've created a symbolic link called /etc/init.d/net.wlan0; I've installed ndiswrapper.

My /etc/conf.d/net looks like this:

 *Quote:*   

> 
> 
> config_eth0=( "192.168.1.3 netmask 255.255.255.0 brd 192.168.1.255" )
> 
> #config_eth0=( "dhcp" )
> ...

 

My /etc/wpa_supplicant.conf looks like this:

 *Quote:*   

> 
> 
> # The below line not be changed otherwise we refuse to work
> 
> ctrl_interface=/var/run/wpa_supplicant
> ...

 

If I do /etc/init.d/net.wlan0 restart I get this:

 *Quote:*   

> 
> 
>  * Stopping wlan0
> 
>  *   Bringing down wlan0
> ...

 

and finally if I do ifconfig:

 *Quote:*   

> 
> 
> eth0      Link encap:Ethernet  HWaddr 00:0A:E4:F4:47:F9
> 
>           inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
> ...

 

Of course wireless doesn't work, else I wouldn't be here.

What's wrong in my configuration? How can I get it working considering that under Ubuntu it works with the configuration mentioned above?

Thanks to enlighten me

----------

## bernied

Maybe wlan0 isn't coming up because eth0 is up.

What happens when you do this:

```
ifconfig eth0 down

ifconfig wlan0 up

dhcpd wlan0
```

(One of the last two commands may be redundant, or they might be better switched)

I don't know how to make this a permanent thing, without disabling eth0, which you don't want, right. Giving eth0 a static address might be the problem, if it were dhcp then it wouldn't come up, so wlan0 would take over.

If that doesn't work, what is the output of 

```
iwconfig
```

Are you connected?

----------

## Chris W

 *Quote:*   

> My /etc/conf.d/net looks like this:
> 
> Quote:
> 
> config_eth0=( "192.168.1.3 netmask 255.255.255.0 brd 192.168.1.255" )
> ...

 Did you mean: iwconfig_wlan0="mode managed"

----------

## bernied

iwconfig is like ifconfig, but is meant for use with wireless network adapters and gives you more information about wireless connections, specifically it will tell you if a connection has been established with your access point - you can have an established connection without having an IP address assigned.

It seems that iwconfig is in the wireless-tools ebuild. Is this installed?

As you can see from the man page iwconfig on its own will list all adapters and show any wireless attributes, I think this would include a list of available networks, if the adapter did not have an established connection.

Did you try the 'eth0 down, wlan0 up' thing?

----------

## bernied

Maybe I should have mentioned that you will have to run iwconfig as root. It will not be seen by a normal user.

----------

## firepol

Thanks for your answers guys.

Chris W: yep I meant iwconfig_wlan0="mode managed"

bernied: dhcpd doesn't work to me, i didnt configure /etc/dhcp/dhcpd.conf ... i use dhclient instead...

i stopped eth0 and did: ifconfig wlan0 up; dhclient wlan0

i get this:

 *Quote:*   

> dhclient wlan0
> 
> Internet Systems Consortium DHCP Client V3.0.5-Gentoo
> 
> Copyright 2004-2006 Internet Systems Consortium.
> ...

 

iwconfig gives me this: *Quote:*   

> 
> 
> iwconfig
> 
> lo        no wireless extensions.
> ...

 

How can I verify if I'm connected to the wireless router?

I tried to use also a static configuration:

 *Quote:*   

> 
> 
> modules=( "wpa_supplicant" )
> 
> wpa_supplicant_wlan0="-Dwext"
> ...

 

it still doesn't work.

By the way, please note that my wireless access point has this IP: 192.168.1.10

But the default gateway of my network is a wired zyxel router, with IP 192.168.1.1 and DHCP enabled...

I repeat, from ubuntu it works, I will check under ubuntu what I get with iwconfig and which one is the default route...

Thanks for helping, I really want to solve this.

----------

## firepol

I don't know why but i have the impression that there is a problem selecting my AP, but I've checked the SSID name is correct.

Under ubuntu this line shows MYSSID instead of "Not-Associated" if I do iwconfig:

 *Quote:*   

> Mode:Managed  Frequency:2.462 GHz  Access Point: Not-Associated

 

I don't know... really, I'm getting crazy because of this.

----------

## Chris W

You could try manually configuring the interface and then checking that it is working in gross terms: 

```
... config interface stuff...

ifconfig wlan0 up

iwlist wlan0 scan

ifconfig wlan0 down
```

 (you should see your AP) then running wpa_supplicant with debug output: 

```
wpa_supplicant -dd -D wext  -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf  2>&1 | tee wpa_supplicant.log 
```

  One thing to look out for is how you have entered the key in the config file; quotes around string keys, and no quotes if the key is a hex string.

----------

## firepol

thanks Chris W... if I do modprobe ndiswrapper, the interface is up (no need to to ifconfig wlan0 up); next step:

 *Quote:*   

> iwlist wlan0 scan
> 
> wlan0     Scan completed :
> 
>           Cell 01 - Address: APMACADDRESS
> ...

 

in my wpa_supplicant.conf I configured pairwise and group to be TKIP, could this be the problem? With the scanning I see WEP-40... I will try to change these parameters and let you know...

 *Quote:*   

> One thing to look out for is how you have entered the key in the config file; quotes around string keys, and no quotes if the key is a hex string.

  I entered the hex key without doublequotes (")...

----------

## Chris W

Excellent, the card is working. *firepol wrote:*   

> ...
> 
> in my wpa_supplicant.conf I configured pairwise and group to be TKIP, could this be the problem? With the scanning I see WEP-40... I will try to change these parameters and let you know...

 TKIP is a layer on top of the same encryption system used in WEP (constantly changing the keys).  I don't think this is the issue.  You could grab a copy of the wpa_supplicant.conf that Ubuntu writes on your behalf, but I'm fairly sure you'll find that it lists TKIP too.

I think the debug output from wpa_supplicant (see my last post) will be more diagnostic.

----------

## XAvAX

This might help: I have wpa_supplicant on my wired (eth0) and wireless (eth1) interfaces, and both automatically acquire IP's. Posting configs:

/etc/conf.d/net

```
modules_eth0=( "wpa_supplicant" )

wpa_supplicant_eth0="-D wired"

wpa_timeout_eth0=60

config_eth0=( "dhcp" )

dhcp_eth0="-t 10"

modules_eth1=( "wpa_supplicant" )

wpa_supplicant_eth1="-D wext"

wpa_timeout_eth1=60

config_eth1=( "dhcp" )

dhcp_eth1="-t 10"
```

/etc/wpa_supplicant/wpa_supplicant-eth0.conf

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=users

ap_scan=0

# Connect to anything unsecured ... Wired, remember?

network={

   ssid=""

   scan_ssid=1

   key_mgmt=NONE

   priority=-999999

}
```

/etc/wpa_supplicant/wpa_supplicant-eth1.conf

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=users

ap_scan=1

network={

        ssid="ElsayedHome"

        scan_ssid=1

        key_mgmt=WPA-PSK

   pairwise=TKIP

        psk="my_secret_psk"

}

network={

        ssid="marlinspike"

        scan_ssid=1

        key_mgmt=WPA-PSK

        psk="my_friend's_secret_psk"

}
```

Try those settings, from /etc/conf.d/net and eth1, and see if it works.

The only quirk I've had is that if wireless and wired are both started, you're connected to wireless, and you plug in ethernet, the disconnect it you have to stop eth0 before any apps'll use the right interface.

----------

