Wifi configuration • 3 Aug 2010
There's a difference how wireless is configured in FreeBSD 7 and 8. I found the following description on the FreeBSD forums:
8.0 also includes the VAP (virtual access point) stuff, which splits all wireless drivers into two parts: the hardware interface and the virtual interface(s).
Whereas in FreeBSD <= 7 you manipulate the wireless interface directly (ath0, wi0, wpi0, etc), in FreeBSD 8+ you first clone the interface and then manipulate the cloned interface.
You'll have something like an ath0 (the hardware interface) that you clone into a wlan0 (or whatever you want to call it). Then you configure the wlan0 interface.
The relevant chapter from the FreeBSD handbook is also a good read.

FreeBSD 7
This example shows how to configure an Atheros card for connecting to a wireless router in WPA security mode. The card gets it IP address from the router via DHCP. Edit in /etc/rc.conf:
ifconfig_ath0="DHCP WPA"
defaultrouter="192.168.1.1"
and in /etc/wpa_supplicant.conf:
network={
ssid="LinksysRouter"
psk="Secret"
}
The 'psk' above stands for 'pre-shared key'. If you use an hexadecimal psk, you should not quote it. (thanks Bubulein on FreeNode ##freebsd)
And here are relevant lines from my /usr/local/etc/kismet.conf:
source=radiotap_bsd_ab,ath0,ath0
defaultchannels=IEEE80211ab:1,6,11,2,7,12,3,8,13,4,9,14,5,10
FreeBSD 8
As said before, FreeBSD 8 requires you to first create a virtual interface, and then configure that interface. The example below uses a fixed IP. Edit in /etc/rc.conf:
wlans_ath0="wlan0"
ifconfig_wlan0="WPA 192.168.1.48/27"
defaultrouter="192.168.1.1"
and because the nameservers aren't provided by DHCP, this is in /etc/resolv.conf:
search mydomain.com
nameserver 192.168.1.33
nameserver 192.168.1.1
nameserver 194.109.6.67
192.168.1.33 is a DNS server in my home network, 192.168.1.1 is the router (as a fallback), and 194.109.6.67 is the DNS server at my provider.
The /etc/wpa_supplicant.conf file is the same as the example I gave earlier.
Monitor mode
If you want to play with security tools like Kismet, you should also create a virtual interface that is allowed to go into monitor mode. That is done thus:
wlans_ath0="wlan0 wlan1"
create_args_wlan1="wlanmode monitor"
ifconfig_wlan0="WPA 192.168.1.48/27"
defaultrouter="192.168.1.1"
...and then kismet is told to use wlan1 instead of wlan0. Edit in /usr/local/etc/kismet.conf:
source=radiotap_bsd_ab,wlan1,wlan1
defaultchannels=IEEE80211ab:1,7,13,2,8,3,14,9,4,10,5,11,6,12