Totally painless USB Wifi with Ubuntu (tested with RealTek based adapters)

Hey guys,

I wanted to share my method for getting USB WiFi working using a fresh install of the latest Ubuntu release from BeagleBoard.org on by BBB.  I pieced these steps together from several tutorials, knowing there had to be a way to just "apt-get" my way to WiFi nirvana... And it is possible!

I have tested two of the cheap adapters from Fry's and confirmed they work:

EnGenius EUB9603H  [RTL8712 firmare]
DLink DWA-121 N150 [RTL8192 firmware]

So far the only issue I can find is that sometimes DHCP takes a while to grab an address..  I prefer DHCP, but if boot time is more important, then by all means use a static IP address.

1. Install the following packages:


wireless-tools

firmware-realtek

usbutils

wpasupplicant


sudo apt-get install wireless-tools firmware-realtek usbutils wpasupplicant

 

2. My wireless network at home is secured with WPA2, so I create the WPA PSK key using my SSID and passphrase:


debian@beaglebone:~$ wpa_passphrase ssid passphrase > /etc/wpa_supplicant.conf

 


3. Edit /etc/network/interfaces:


# WiFi Example

auto wlan0

#allow-hotplug wlan0

iface wlan0 inet dhcp

       wpa-driver wext

       wpa-conf /etc/wpa_supplicant.conf


4. If you have not already connected your USB WiFi adapter, you can do it now.

5. Reboot...

sudo reboot

Log in and check to verify wlan0 got an address:

debian@beaglebone:~$ sudo ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr
          inet addr:192.168.1.69  Bcast:192.168.1.255  Mask:255.255.255.0

Check to see we are actually connected to the interwebs:

debian@beaglebone:~$ ping google.com
PING google.com (173.194.115.38) 56(84) bytes of data.
64 bytes from dfw06s40-in-f6.1e100.net (173.194.115.38): icmp_req=1 ttl=55 time=32.7 ms
64 bytes from dfw06s40-in-f6.1e100.net (173.194.115.38): icmp_req=2 ttl=55 time=38.1 ms


If you like to swap adapters (I like to test out stuff), you'll run into an issue where the next adapter will be "wlan1", followed by "wlan2", etc, breaking the interface configuration.  I'm sure there is a way to be smarter about binding to the correct adapter, but I found editing the "NAME" field of the new adapter in /etc/udev/rules.d/70-persistent-net.rules is a quick-and-dirty fix.