# connect to a Free Wi-Fi Hotspot



## ccc (Aug 8, 2009)

Hi

I've notebook EEE PC 1000H from Asus with freeBSD 7.2 and ndis module.
There is WPA2-PSK configured. 

Howto configure wireless interface to switch from WPA2-PSK to a free open Wi-Fi Hotspot 
and back if needed?


----------



## adamk (Aug 8, 2009)

Yesterday afternoon I gave you this link:

http://www.freebsd.org/doc/en/books/handbook/network-wireless.html

You can/should use wpa_supplicant for both encrypted and unencrypted wireless networks.  Just read that section of the handbook and the wpa_supplicant.conf man page.

Adam


----------



## ccc (Aug 11, 2009)

Yep and THX.
My problem is, I have configured WPA2-PSK for my home wireless router, but if I'm traveling my notebook should switch to the open, unencrypted Wi-Fi Hotspots.
Should I write an extra script to change the network settings or there is an other solution?


----------



## adamk (Aug 11, 2009)

Re-read the wpa_supplicant.conf man page   You can configure different wireless networks in there with different priorities:


```
network={
        ssid="myssid"
        key_mgmt=WPA-PSK
        pairwise=TKIP
        psk=key
        priority=5
}

network={
        key_mgmt=NONE
        priority=0
}
```

It will connect to any available open wireless network, but only if "myssid" is not available.

If you are using DHCP in both locations, it will just work fine.  If you switch from one location to another, without shutting down, you can force wpa_supplicant to rescan, and dhcp to restart, by running '/etc/rc.d/netif restart wlan0' (assuming wlan0 is your interface), but I believe this will happen as soon as wpa_supplicant detects the network change anyway.

Adam


----------



## ccc (May 11, 2010)

Thx, I've tried the following configuration in /etc/wpa_supplicant.conf on my freeBSD 7.3 RELEASE:
	
	



```
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
eapol_version=2
ap_scan=1
fast_reauth=1


network={
        scan_ssid=1
        ssid="myessid"
        proto=RSN 
        key_mgmt=WPA-PSK
        pairwise=CCMP
        group=CCMP
	psk=secretkey
        priority=5
}

network={
        key_mgmt=NONE
        priority=0
}
```
If I understand correctly, the highest priority number has the highest priority. 
Now if I try to restart network:
	
	



```
/etc/rc.d/netif restart
```
then I'm getting the IP address from my neighbour with unsecured instead of my secured wlan.
Howto set my secured wlan as a default connection?


----------



## phinux (May 12, 2010)

not sure how to fix it but something i did was use wifimgr. it created a wpa_supplicant.conf for me and i used that as an example.

http://opal.com/freebsd/ports/net-mgmt/wifimgr/
http://www.freshports.org/net-mgmt/wifimgr/


----------

