Packetwatch.net

Wireless in FreeBSD 6.2



Last modified: Jul. 26, 2008

Contents
1 - Summary
2 - Kernel Configuration
3 - Wireless Commands
4 - WEP Network Configuration
5 - WPA2-Personal (WPA-PSK) Network Configuration


1 - Summary

This little guide will show you how to get wireless working in FreeBSD 6.2.
For this guide to work you will need to have your wireless network card
installed and be running FreeBSD 6.2. The card I have is a Cisco Aironet
CardBus card (CB21AG).


2 - Kernel Configuration

You will need to have the following lines added to your kernel configuration
file.

  device          wlan                    # 802.11 support
  device          wlan_wep                # 802.11 WEP support
  device          wlan_ccmp               # 802.11 CCMP support
  device          wlan_tkip               # 802.11 TKIP support
  device          ath                     # Atheros pci/cardbus NIC's
  device          ath_hal                 # Atheros HAL (Hardware Access Layer)
  device          ath_rate_sample         # SampleRate tx rate control for ath

After adding these lines into your kernel configuration file you will need to
recompile the kernel and reboot your machine. After rebooting your machine,
you should see something like the following for your wireless card.

  ath0:  mem 0xf6010000-0xf601ffff irq 16 at device 0.0 on cardbus0
  ath0: Ethernet address: 00:40:96:af:20:70
  ath0: mac 5.9 phy 4.3 radio 3.6


3 - Wireless Commands

You can display the capabilities of your wireless card by typing the
following.

# ifconfig ath0 list caps
ath0=783ed0f WEP,TKIP,AES,AES_CCM,IBSS,HOSTAP,AHDEMO,TXPMGT,SHSLOT,SHPREAMBLE,
MONITOR,TKIPMIC,WPA1,WPA2,BURST,WME

You can search for wireless access points by typing the following.

# sudo ifconfig ath0 up scan
SSID            BSSID              CHAN RATE  S:N   INT CAPS
********        00:1a:c4:c4:1d:e9    2   54M 11:0   100 EPS
********        00:1a:c4:0f:47:59    4   54M  7:0   100 EPS
********        00:19:e4:b0:f2:a1    4   54M  4:0   100 EPS
*****           00:14:95:ce:46:29    6   54M  5:0   100 EPS
******          00:14:bf:18:a5:bb    6   54M  4:0   100 E
*****           00:1b:11:eb:6f:3f    6   54M  6:0   100 ES
******* *****   00:1b:2f:d6:83:60    9   54M 11:0   100 EPS  WPA WME
********        00:15:e9:d3:ee:0a   11   54M 20:0   100 EPS
*********       00:11:95:2c:6e:c0   11   54M 23:0   100 EP
*********       00:14:bf:38:e9:43   11   54M 10:0   100 EP   WPA
*********       00:17:3f:59:50:7e   11   54M 39:0   100 EP   RSN
********        00:14:6c:92:0d:d2   11   54M 14:0   100 EP
****            00:11:50:71:bb:34   11   54M 19:0   100 EPS
***********     00:19:a9:a9:37:a0   36   54M 31:0   100 EP   WME
***********     00:19:a9:a5:37:c0    1   54M 44:0   100 EPS  WME


4 - WEP Network Configuration

You can connect to a WEP network by doing the following. This command will
associate your machine to the access point with the following: an open
authorization mode, a specified bssid (MAC address of the AP), a specified
key with hexidecimal value, and a specified ssid.

# sudo ifconfig ath0 authmode open bssid 00:19:A9:A5:37:C0 deftxkey 1 \
ssid *********** wepmode on wepkey 1:0x000...

You can now get an IP address via DHCP.

# sudo dhclient ath0
DHCPREQUEST on ath0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.8
bound to 192.168.1.16 -- renewal in 43200 seconds.

Check the status of your ath0 device.

# ifconfig ath0
ath0: flags=8843 mtu 1500
        inet 192.168.1.16 netmask 0xffffff00 broadcast 192.168.1.255
        ether 00:40:96:af:20:70
        media: IEEE 802.11 Wireless Ethernet autoselect (OFDM/54Mbps)
        status: associated
        ssid *********** channel 1 bssid 00:19:a9:a5:37:c0
        authmode OPEN privacy ON deftxkey 1 wepkey 1:104-bit txpowmax 40
        bmiss 7 protmode CTS burst bintval 100

You can set your machine to connect to this access point at startup by doing
the following.

  ifconfig_ath0="authmode open bssid 00:19:A9:A5:37:C0 deftxkey 1 \
  ssid *********** wepmode on wepkey 1:0x000... DHCP"

# sudo vi /etc/rc.conf


5 - WPA2-Personal (WPA-PSK) Network Configuration

You can connect to a WPA2-Personal (WPA-PSK) network by doing the following.
This command will generate a pre-shared WPA key from an ASCII passphrase and
a specified ssid. The output will need to be added to network block in the
/etc/wpa_supplicant.conf file.

# wpa_passphrase ssid passphrase
network={
        ssid="***********"
        #psk="***********"
        psk=****************************************************************
}

Add the following to /etc/wpa_supplicant. This network block specifies the
following: a specified ssid, scan enabled for ssid that isn't broadcast, a
specified bssid (MAC address of the AP), a specified wireless protocol, a
specified key management protocol, a specified pairwise cipher, a specified
group cipher, and a specified WPA pre-shared key.

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

  network={
          ssid="***********"
          scan_ssid=1
          bssid=00:13:10:da:df:04
          priority=0
          proto=RSN
          key_mgmt=WPA-PSK
          pairwise=CCMP
          group=CCMP
          #psk="***********"
          psk=****************************************************************
  }

# sudo vi /etc/wpa_supplicant.conf

This command will associate your machine to the access point.

# sudo wpa_supplicant -i ath0 -c /etc/wpa_supplicant.conf
Trying to associate with 00:13:10:da:df:04 (SSID='***********' freq=2412 MHz)
Associated with 00:13:10:da:df:04
WPA: Key negotiation completed with 00:13:10:da:df:04 [PTK=CCMP GTK=CCMP]
CTRL-EVENT-CONNECTED - Connection to 00:13:10:da:df:04 completed (auth)

You can now get an IP address via DHCP.

# sudo dhclient ath0
DHCPREQUEST on ath0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.10 -- renewal in 43200 seconds.

Check the status of your ath0 device.

# ifconfig ath0
ath0: flags=8843 mtu 1500
        inet 192.168.1.10 netmask 0xffffff00 broadcast 192.168.1.255
        ether 00:40:96:af:20:70
        media: IEEE 802.11 Wireless Ethernet autoselect (OFDM/54Mbps)
        status: associated
        ssid *********** channel 6 bssid 00:13:10:da:df:04
        authmode WPA2/802.11i privacy ON deftxkey UNDEF AES-CCM 2:128-bit
        txpowmas 40 bmiss 7 protmode CTS burst roaming MANUAL bintval 100

You can set your machine to connect to this access point at startup by doing
the following.

  ifconfig_ath0="WPA DHCP"

# sudo vi /etc/rc.conf


Last modified: Thu Jan 1 00:00:00 1970 UTC
Packetwatch Research 2002-2017.