# Unstable wireless connection;  any better solutions?



## everypot (Aug 2, 2011)

Atheros wireless card, FreeBSD 8.2. 

Everything works, except one problem: it will disconnect after a certain period of time (10 mins, for example). To reconnect, I  have to use 
	
	



```
dhclient wlan0
```
. 

To simplify the task, I wrote a simple shell script which basically repeats the above commands every 5 mins, to make sure that I can have consistent wireless connection. I set the shell script auto-run whenever the system starts. It works, but I feel it's kind of dumb. Unfortunately, I don't know any other solutions. 

Is there a better/cleaner way to solve this problem?


----------



## SirDice (Aug 2, 2011)

Check the settings on your DHCP server. There's no reason why a lease should expire after 5 minutes and not get renewed.


----------



## fonz (Aug 2, 2011)

everypot said:
			
		

> To simplify the task, I wrote a simple shell script which basically repeats the above commands every 5 mins
> [snip]
> It works, but I feel it's kind of dumb. Unfortunately, I don't know any other solutions.


When you get a new lease, look (probably requires root) in /var/db/dhclient.leases._<interface>_ to see whether you get a very short DHCP lease or the connection is dropped for some other reason.

As for your script, have you tried setting the _renew_ and/or _rebind_ and/or _expire_ options in /etc/dhclient.conf manually (see dhclient.conf(5))?

Fonz


----------



## wblock@ (Aug 2, 2011)

A DHCP lease expiring shouldn't lose the connection, though.  Just pinging the access point once every five minutes would be cheaper and might be enough, though still a hack.


----------



## fonz (Aug 2, 2011)

wblock said:
			
		

> A DHCP lease expiring shouldn't lose the connection, though.


Indeed. It's supposed to be renewed automagically. Which makes me suspect that there might be another reason why the connection gets dropped all the time.

Fonz


----------



## wblock@ (Aug 2, 2011)

I would also check settings on the access point.


----------

