OpenBSD: Configure Ralink USB IEEE 802.11a/g/n Wireless Network Adapter

by on November 28, 2012 · 3 comments· LAST UPDATED November 28, 2012

in

I brought a USB 2.0 wireless adapters based on the Ralink RT2700U, RT2800U and RT3000U chipsets. How do I configure and use it under OpenBSD operating systems?

Tutorial details
DifficultyIntermediate (rss)
Root privilegesYes
RequirementsOpenBSD with run driver
Estimated completion timeN/A

This usb wireless adapter works out of box under OpenBSD and Linux operating systems. Under OpenBSD you need to use run driver. From the man page:

The run driver can be configured to use Wired Equivalent Privacy (WEP) or Wi-Fi Protected Access (WPA-PSK and WPA2-PSK). WPA is the de facto encryption standard for wireless networks. It is strongly recommended that WEP not be used as the sole mechanism to secure wireless communication, due to serious weaknesses in it. The run driver offloads both encryption and decryption of data frames to the hardware for the WEP40, WEP104, TKIP(+MIC) and CCMP ciphers.

Step #1: Make sure device is detected by OpenBSD

Type the following command:
# dmesg | egrep -i 'wlan|usb|run'
Sample outputs:

ohci0 at pci0 dev 19 function 0 "Compaq USB OpenHost" rev 0x08: irq 5, version 1.0, legacy support
usb0 at ohci0: USB revision 1.0
uhub0 at usb0 "Compaq OHCI root hub" rev 1.00/1.00 addr 1
run0 at uhub0 port 1 "Ralink 802.11 n WLAN" rev 2.00/0.01 addr 2
run0: MAC/BBP RT2872 (rev 0x0202), RF RT2820 (MIMO 2T2R), address 00:aa:xx:yy:e4:6e

You can use usbdevs comamnd to see USB devices connected to the system:
# usbdevs
Sample outputs:

addr 1: OHCI root hub, Compaq
 addr 2: 802.11 n WLAN, Ralink

You can also use the ifconfig command:
# ifconfig run0

Step #2: Connect to the wireless router

Type the following command:

 
ifconfig run0 nwid {YOUR-SSID-NETWORK} wpa wpakey {YOUR-PASSHPRASE}
 

In this example, connect the nixcraft network ID (ESSID) with wpa security password (passphrase) called foobar:

 
ifconfig run0 nwid nixcraft wpa wpakey foobar
 

Finally, use the dhclient utility to configuring network interfaces using DHCP to get an IP address from the wireless router / access point:
# dhclient run0
Sample outputs:

DHCPREQUEST on run0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.254 (74:ad:01:xx:yy:zz)
bound to 192.168.1.116 -- renewal in 43200 seconds.

Verify your connectivity:
# ping google.com
# ping cyberciti.biz
# netstat -nr
# cat /etc/resolv.conf

You can use ifconfig command to scan wireless network:
# ifconfig run0 scan
Sample outputs:

run0: flags=8843 mtu 1500
        lladdr 00:1d:xx:yy:zz:dd
        priority: 4
        groups: wlan egress
        media: IEEE802.11 autoselect (OFDM54 mode 11g)
        status: active
        ieee80211: nwid nixcraft chan 1 bssid 74:44:xx:yy:zz:dd 50dB wpakey 0x20c356ae19610381977a7d0d9ebd9ee279 wpaprotos wpa1,wpa2 wpaakms psk wpaciphers tkip,ccmp wpagroupcipher tkip
                nwid dd-wrt chan 6 bssid 00:0f:xx:yy:zz:dd 54dB 54M privacy,short_slottime
                nwid asusap chan 6 bssid 00:24:xx:yy:zz:dd 56dB 54M privacy,short_preamble,short_slottime
                nwid testloop chan 1 bssid 74:44:xx:yy:zz:dd 50dB 54M privacy,short_slottime
                nwid seema chan 6 bssid 80:a1:xx:yy:zz:dd 64dB 54M privacy,short_slottime
                nwid bbcafe chan 6 bssid 80:a1:xx:yy:zz:dd 64dB 54M privacy,short_slottime
        inet 192.168.1.116 netmask 0xffffff00 broadcast 192.168.1.255

Step #3: Persistent network configuration

Add the following entry to /etc/hostname.run0 file that configures run0 to join nixcraft network available on boot, using WPA key 'SOMEPASSWORD', channel 1, obtaining an IP address using DHCP:
echo 'dhcp nwid nixcraft wpa wpakey SOMEPASSWORD chan 1' > /etc/hostname.run0
Reboot the system to test changes or type the following command to restart networking under OpenBSD:
# ifconfig run0 down
# sh /etc/netstart

Recommend readings
  1. man pages: run, hostname.if, and ifconfig
  2. List: Linux Compatible USB Wireless Adapter (WUSB)
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 3 comments… read them below or add one }

1 rickster January 8, 2013 at 10:47 am

Yes but “who” makes it and sells it. Model# please ?
“…”brought a USB 2.0 wireless adapters based on the Ralink RT2700U, RT2800U and RT3000U chipsets…”.

Hi,
and thanks for the howto, but any chance you could be a little more specific in the exact Name/Model… of the item you bought in the store.?

I would very much like to purchase, one of these, since obviously the “Atheros AR9485″ that is presently built-in to my new Laptop can NOT be configured in OpenBSD.
Sadly, bad, bad “Atheros”(lately) will NOT even supply the firmware/docs for *BSD !?. :(

Reply

2 nixCraft January 8, 2013 at 11:37 am

Personallu, I am using “Buffalo WLI-UC-G300N Wireless LAN Adapter” with OpenBSD v5.3.

Pro tip: read the man page of the following to see exact make and models for various USB WLAN devices:

man 4 ral
man 4 ural
man 4 rum
man 4 run
man 4 uath
man 4 upgt
man 4 urtw
man 4 zyd
man 4 atu

HTH

Reply

3 rickster January 9, 2013 at 7:36 am

Thankyou.

Reply

Leave a Comment

Tagged as: , , , , , , ,

Previous Faq:

Next Faq: