Setup USB Wireless Adapter FreeBSD 11+

Setting up a wireless adapter on FreeBSD may not be as straightforward as it does in Linux, at times. I actually had several attempts before I finally get it to work. Below is a simple tutorial (that worked for me) on how you can setup a USB wireless adapter on FreeBSD 11. Let’s get started.

Identify Wireless Adapter

First, you need to identify your wireless adapter. On FreeBSD 11 and newer versions you can check for your wireless adapter by typing this command:

$ sysctl net.wlan.devices

On older version of FreeBSD use this command instead:

$ ifconfig | grep -B3 -i wireless

I’m using Realtek 802.11n NIC adapter so my output on the above command was:

greencloud ~ $ sysctl net.wlan.devices
net.wlan.devices: urtwn0

This basically tells us that since I’m using Realtek, I’ll be using the urtwn(4) wireless device driver. See the urtwn manual (man urtwn) for more information.

Current Situation: I already have this USB wireless adapter plugged in but, running the ifconfig -a command doesn’t show up any wireless device running on the system. So, we’re going to create one.

Loading the Driver (As Module)

Now open up and edit /boot/loader.conf using your favorite text editor and append these two lines of codes to what you already have there:

legal.realtek.license_ack=1
if_urtwn_load="YES"

The first line, legal.realtek.license_ack=1, is basically telling to the wireless driver (Realtek) that agree to its terms (License). The second line,  if_urtwn_load=”YES”, loads the driver as a module into the FreeBSD kernel.

Reboot your computer before you continue to the next step (Important!).

Creating and Configuring Wireless Interface

Now to create the Wireless LAN interface run this command as root or use sudo:

$ sudo ifconfig wlan0 create wlandev urtwn0

Then we can turn on this device so it can start scanning for your wireless network:

$ sudo ifconfig wlan0 up scan

To permanently apply this setting on the system, append these two lines of codes in your /etc/rc.conf file:

wlans_urtwn0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"

Also you need to configure your authentication file at /etc/wpa_supplicant.conf. If the file does not exist, create it. Then type in these lines of codes in this file:

network={
    ssid="Your-SSID"
    psk="Your-Wireless-Password"
}

Just make sure you type in the correct SSID and your wireless password. Save the file and reboot your computer once again. After reboot you should have your wireless adapter up and running. Hope this helps.

3 thoughts on “Setup USB Wireless Adapter FreeBSD 11+

  1. Hi,
    is it in wpa_supplicant.conf
    clear password or the password generated by
    wpa_passphrase myssid myssidpass
    network={
    ssid=”myssid”
    #psk=”mypass”
    psk=2345245245245243523452452345435f2345df245f2d45f2d45f24
    }

    Like

Leave a comment