Tutorial details | |
---|---|
Difficulty | Intermediate (rss) |
Root privileges | Yes |
Requirements | OpenBSD with run driver |
Time | N/A |
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
- man pages: run, hostname.if, and ifconfig
- List: Linux Compatible USB Wireless Adapter (WUSB)
🐧 3 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
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 !?. :(
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:
HTH
Thankyou.