# Proper way of reconnecting wifi



## parrot (Feb 23, 2010)

Hello, as I have written in another thread, I am using a TP-Link TL-WN321G USB wifi adapter to connect to my wireless AP. At system sturtup, it connects without problems, however after some usage (maybe half an hour, or an hour, sometimes less, sometimes more), it looses connection. My question is: what is the preoper way of restoring the connection in this case?

What I have tried is the followig:
- Just wait. (Nothing happens, connection remains down).
- Run wpa_supplicant manually. (Not able to reconnect: it cannot associate, or after association, it cannot exchange keys. Tried even ifdown and ifup first, without any luck).
- Reboot the system: in this case, it works again.

Due to this, I suspect, that when the connection is lost, the driver gets into some "locked" state, and there should be some command to "unlock" it.

In case it matters, my configuration is the following:

chipset: rum0
wireless interface: wlan0

wpa_supplicant.conf:

```
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
   ssid="<My_SSID>"
   scan_ssid=1
   key_mgmt=WPA-PSK
   psk="XXXX"
}
```

the relevant parts of rc.conf:

```
defaultrouter=192.168.2.1
...
SNIP
...
hostname="<MY_hostname>"
wlans_rum0="wlan0"
ifconfig_wlan0="DHCP WPA"
...SNIP
```

One remark: sometimes (before login, or shortly after) I get the following message:

```
rum0: need multicast update callback
```
Maybe I have not configured something correctly?

Currently I am using FreeBSD in console mode, because I want to upgrade every package before configuring KDE (thus I cannot use graphical tools to configure the network)


----------



## ZappyDaemon (Feb 24, 2010)

I use:

```
$ wpa_cli reassoc
```


----------



## jb_fvwm2 (Feb 24, 2010)

```
dhclient wlan0
```
AFAIK. (90 percent sure in this case)
Saw it posted somewhere once, tried it, now
99 percent of the time a page fails to load, 
putting that command in an xterm or Eterm 
or aterm will restore it.  Like the first
paragraph in your post above, happens sometimes
at twenty minute mark, sometimes after an
hour...


----------



## juedan (Feb 24, 2010)

Hello parrot,

on my notebook I used the following:
`/etc/rc.d/netif start/stop`

This was inserted in my suspend/resume scripts and worked superb.


----------



## juedan (Feb 24, 2010)

Hello parrot,

are you sure that your hardware does not have a thermal problem?


----------



## lme@ (Feb 24, 2010)

I had the same on a 8.0 machine with if_rum yesterday.
First try: `# /etc/rc.d/netif restart` worked for a few seconds and then the system panicked.
Second try: `# /etc/rc.d/netif stop`, remove and re-insert USB stick, connectivity goes up and down every few seconds.
After a reboot, it worked again...


----------



## richardpl (Feb 24, 2010)

Got backtrace?


----------



## parrot (Feb 24, 2010)

Hi, evverybody! Thanks for the tips, I will try all of them, and see which one works for me best 


juedan: The adapter _is_ getting warmer after usage. Can this cause connectivity issues? And if so, what can be done about it? Should it be periodically disconnected from the machine and then connected back? (Or should I just blow on it? 


richardpl: Could you please tell me more specificly what is _backtrace_? Is it some kind of error message, or a log...


----------



## lme@ (Feb 25, 2010)

richardpl said:
			
		

> Got backtrace?



Unfortunately not... I was in a hurry, and this was my gf's computer, so I don't know when I can test it again.


----------

