# wlan0 interface does not get address via dhcp after boot



## jeraymond (Jan 5, 2011)

Hello,

I'm running 8.1-RELEASE. I've setup wireless networking via an ndis wrapped driver. The network card successfully associates with the access point after boot, but doesn't not obtain and IP address via DHCP. I currently need to manually trigger the dhclient on wlan0 to get an address.


I have in /boot/loader.conf

```
ndis_load="YES"
if_ndis_load="YES"
bcmwl564_sys_load="YES"
```
And in /etc/wpa_supplicant.conf

```
network={
        ssid="ZTB-RLN"
        key_mgmt=WPA-PSK
        psk="some password"
}
```
And in /etc/rc.conf

```
wlans_ndis0="wlan0"
ifconfig_wlan0="WPA DHCP"
```

Any suggestions or ideas how to debug why dhcp isn't happening automatically on boot for this wlan adapter?


----------



## SirDice (Jan 5, 2011)

Try:

```
ifconfig_wlan0="WPA SYNCDHCP"
```

That might work.


----------



## jeraymond (Jan 5, 2011)

I had seen this one suggested in the forums and gave it a try earlier, but it made no difference.


----------



## SirDice (Jan 5, 2011)

:e

You can turn on debugging, perhaps that will give us some clues.

Add to /etc/rc.conf:

```
rc_debug="YES"
```


----------



## kpedersen (Jan 5, 2011)

Though probably not the best way to do this, I wrote a script that is started automatically and keeps attempting to ping the router. If after 15 seconds there is no response, it resets andreconnects (wpa_supplicant and dhclient).

This method works with roaming access points and also with the wireless switch.

An early prototype of this script can be found at (http://forums.freebsd.org/showpost.php?p=111068&postcount=104)


----------



## jeraymond (Jan 7, 2011)

SirDice said:
			
		

> :e
> 
> You can turn on debugging, perhaps that will give us some clues.
> 
> ...



I've enabled rc_debug and put the /var/log/messages output from a reboot here https://gist.github.com/770035. Near the end of the log I see some wpa_suplicant messages but nothing about DHCP. The wlan0 interface doesn't get a IP Address (though the wired adapter rl0 does) after boot. I still need to manually do a 
	
	



```
#dhclient wlan0
```
 to get an IP for the wlan0 interface.


----------



## nerok (Jan 9, 2011)

You can modify your rc.conf section ifconfig_wlan0 to:

```
ifconfig_wlan0="WPA ssid yourssid bssid APMAC adress DHCP"
```

You should also read http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-wireless.html
Use code for refresh interface:

```
/etc/rc.d/netif start
```


----------



## nickednamed (Aug 4, 2011)

I'm having exactly the same problem.

I'm running FreeBSD 8.1-RELEASE on a Dell Inspiron 5160.

I'm also using an NDIS wrapper thingy [although a different driver], and have the same stuff written in my config files.

Every time i boot i have to "su" and run "dhclient wlan0" which is kind of tiresome.

I was hoping to eventually do some kind of script to sort this out, but I'm so new to non-windows stuff, it will have to wait.

Has this problem been solved?


----------



## jeraymond (Aug 5, 2011)

I never found a solution. Then the vm I had BSD installed on borked.


----------



## wblock@ (Aug 5, 2011)

nickednamed said:
			
		

> I'm having exactly the same problem.
> 
> I'm running FreeBSD 8.1-RELEASE on a Dell Inspiron 5160.



Step 1 is updating to a recent version, preferably -STABLE.  -CURRENT has the latest wireless code and works well, too.


----------



## wblock@ (Aug 5, 2011)

jeraymond said:
			
		

> I never found a solution. Then the vm I had BSD installed on borked.



How were you using wireless on a VM?


----------



## jeraymond (Aug 6, 2011)

Heh... yea. Sorry I was confusing two issues I had. I had FreeBSD installed on a laptop and never did find a solution to the wlan issue on this post. I also had FreeBSD on a VM that died.


----------



## nickednamed (Aug 6, 2011)

I'm now running 8.2-RELEASE, but nothing changed. Still have to manually connect, as su, on every boot.

Also, my connection keeps dropping every so often [my windows xp laptop has no such problems]

I've followed the handbook exactly, and done what i can with the man pages.

Perhaps a problem with the /var/db/dhclient.leases.IFNAME file?

And would setting the timeout variable in the dhclient.conf file to a low value such as 10secs be a good idea to help with the constant dropped connections?

Any help would be greatly appreciated.


----------



## wblock@ (Aug 6, 2011)

You'll have to provide more information.  What wireless card?  What settings in /etc/rc.conf?

Dropped connections are a different problem than DHCP.


----------



## nickednamed (Sep 23, 2011)

wblock@ said:
			
		

> You'll have to provide more information.  What wireless card?  What settings in /etc/rc.conf?
> 
> Dropped connections are a different problem than DHCP.



Unfortunately this laptop died on me a while back, and haven't got round to sorting it out yet so i can't be 100% sure about either of those things.

But thanks for the info, will look into that,


----------

