FreeBSD has strong support for wireless devices. Here is a quick overview of how to manage wireless interfaces on FreeBSD.
For Wireless access requires the following:
- A wireless interface card
- An Access Point
Note: In later of versions of FreeBSD, since 2008, wpa_supplicant was included in base. If you are running an older version of FreeBSD, then wpa_supplicant was a port. So if you are on FreeBSD 8, you have wpa_supplicant.
To complete this guide, we will also use:
- A FreeBSD desktop environment.
Note: wpa_gui is not included in the base system but is found in ports.
Step 1 – Determine what wireless interface card you have
Some wireless cards are built into the kernel, and may already be loaded. If you know what card you have, skip this step.
- First, we need to find out what wireless card you have. Run ifconfig and look at the network cards you have. Then to see which one is your wireless card, compare them to the wireless kernel module list here:
Notice in the above configuration, no wireless card was discovered. Here is an example of one with a wireless card.
- Most wireless cards are PCI devices. Run pciconf to look for your wireless network card type. This outputs a lot of information, I have snipped my output to isolate only the information about the wireless PCI card.
- Now go to the current release notes for FreeBSD and look through the wireless kernel modules to see which one supports your hardware.
Note: I searched for 4965AGN and found my kernel module immediately.
- Keep the link open as you move to Step 2.
Step 2 – Make sure the kernel module is loading
If your wireless card is already detected and loading, skip this step. If not, configure /boot/loader.conf to load your wireless card.
- Read the man page for your wireless kernel module, there is a link to it in the hardware notes, to see any special information about loading the kernel module for your kernel module.
- Configure the /boot/loader.conf to load the kernel module and make any other required settings to use the kernel module.Example 1 – The Intel iwn kernel module requires a line to load the kernel module and a second line to load the firmware.
Example 2 – The Intel iwi kernel module requires that you accept a license agreement:
- Save and close the /boot/loader.conf
- Now you can either reboot, or you can use kldload to load the kernel modules without rebooting.
Step 3 – Configure the wireless settings in /etc/rc.conf
The rc.conf is where the wireless network card is configured.
- In FreeBSD 8 and later, all wireless interfaces should be configured to use the generic wlan device. Then to enable wpa_supplicant, the wlan should be configured to use WPA.
To make these configurations, add these lines to the /etc/rc.conf.
- Save and close /etc/rc.conf.
Step 4 – Add your Access Point’s (AP) SSID to your /etc/wpa_supplicant.conf
There is a lot of information on how to add an SSID to your /etc/wpa_supplicant.conf file in the man page for wpa_supplicant.conf. But the process is simple.
- If you don’t know the SSID, discover or scan for the SSID by running ifconfig wlan0 scan. Below is an example.
- Now add a network entry for the desired wireless device. Examples are below:
Open or no authentication
WPA or WPA2
For more examples, read the man page for wpa_supplicant.conf.
Once the SSID is configured properly in the /etc/wpa_supplicant.conf, then an automatic connection to this AP will occur whenever the device is within range.
Step 5 – Install wpa_gui from ports
Often you don’t always know what wireless you are going to connect to and also often you don’t care to store the SSID configuration permanently in the /etc/wpa_supplicant.conf. This is common if you are getting online at an airport, coffee shop, or any hotspot that you don’t frequent. It would be nice to have a graphical interface that shows you the SSIDs available, allows you to connect, but doesn’t store the information. wpa_gui is this tool.
- Install wpa_gui from ports
- Add the following two lines to the top of the /etc/wpa_supplicant.conf.
- Restart the wpa_supplicant.# /etc/rc.d/wpa_supplicant restart wlan0
- Run wpa_gui.
- Click Scan and a window listing the available SSIDs appears.
- Double-click on an SSID to get the configuration windows. It will try to select the correct settings as best it can, so often you only need to add the psk or passkey, which is essentially a password.
- This will connect you to that SSID.
Note: If you do want to save the networks to the wpa_supplicant.conf by default, then add this line. Otherwise, they are not saved. You may or may not want them to be saved.
Note 1: PC-BSD has a network configuration tool, so if you are running PC-BSD, wpa_gui is not necessary.
Note 2: There is a command line tool called wpa_cli that is included in the base system. wpa_cli is useful if you don’t have a graphical environment.
Note 3: I also configured link aggregation, or lagg, so my wired and wireless interfaces share the same MAC.
Copyright ® Rhyous.com – Linking to this page is allowed without permission and as many as ten lines of this page can be used along with this link. Any other use of this page is allowed only by permission of Rhyous.com.