I have an OpenBSD 5.1 i386 installed. I have no GUI/X. I googled for the answer but I can't find authentic one. How can I connect to a WPA2 PSK/AES wifi network using only the terminal? (so I don't have a "network manager" to simply select the given SSID, then enter passphare :D)

UPDATE: wifi card: Atheros AR5424, I can see it as "ath0"



doesn't worked in /etc/hostname.ath0 (then the sh /etc/netstart ath0)


ifconfig ath0 nwid SSID wpa wpapsk $(wpa-psk SSID SSIDPWD)


ksh: wpa-psk not found
ifconfig: wpapsk: bad value


The router is an OpenWrt 10.03.1 box:

cat /etc/config/wireless
config 'wifi-iface'
    option 'device' 'radio0'
    option 'network' 'lan'
    option 'mode' 'ap'
    option 'ssid' 'SSID'
    option 'encryption' 'psk2+ccmp'
    option 'key' 'SSIDPWD'
    option 'isolate' '1'
    option 'maxassoc' '1'

I didn't seen anything in the logs associated to the openbsd eee pc 701 :D

UPDATE#5: I tested the SSID with the SSIDPWD, and it worked on a Scientific Linux 6.3 notebook.


ifconfig ath0 nwid SSID wpakey SSIDPWD

I tried this one too, it didn't gived back any error messages, but I still can't see anything on the openwrt router, that it tries to connect, I can only see change in "ifconfig ath0" - I can see the "ieee8011" line is filled up.

UPDATE#7: whoops :) I maybe have an idea what is the problem. :D I only have the motherboard of the eee pc 701 and the wifi card in it.. :D with NO ANTENNAS :D - so I will try to find an antenna :)

  • anyone? :) I have to put a bounty on this :) Commented Sep 18, 2012 at 11:39
  • wpa_supplicant doens't work for you?
    – daisy
    Commented Sep 19, 2012 at 14:13
  • but how?? :) what are the exact commands? :O Commented Sep 19, 2012 at 16:27
  • What wireless network adapter are you using? Commented Sep 22, 2012 at 0:41

2 Answers 2


Create a hostname file in /etc with the interface's name.


Add to it:

dhcp nwid "Name of network" wpakey password

Restart the interface.

sudo sh /etc/netstart iwn0

This way connection to the wireless network will be attempted on boot.

If you don't know the name of the wireless interface run,


and look for 802.11 in 'media' or wlan in 'groups'.

  • @gaskopeter, I am using the exact same way of configuration for my wireless card. kuda has outlined the correct procedure and you can find it in OpenBSD faqs too. I think either you did not name your hostname file correctly - hostname.{interface name} or you did not specify wpakey password correctly in that file.
    – Salil
    Commented Oct 22, 2012 at 22:55

From what I have been reading, apparently on OpenBSD you can configure the SSID and WPA shared secret key on the ifconfig command line.

Please see:


Configure ral0 to join network “my_net” using WPA-PSK with passphrase “my_passphrase”:

    # ifconfig ral0 nwid my_net wpa wpapsk \
         $(wpa-psk my_net my_passphrase)



Configure ral0 to join network my_net'' using WPA with passphrase my_passphrase'':

    # ifconfig ral0 nwid my_net wpakey my_passphrase
  • I'm surprised that ifconfig ath0 nwid SSID wpakey SSIDPWD didn't work. After you run this command, if you just enter ifconfig what is displayed? Do you get an IP address or any 802.11 information? Can you safely post what is displayed for that command here? Commented Oct 1, 2012 at 15:54
  • "ifconfig ath0" displayed 802.11 information, but it didn't displayed IP address :) Commented Oct 1, 2012 at 16:03
  • Here's an example from Wikipedia that shows an interface that has associated with the access point ieee80211: nwid ARK chan 11 bssid 00:0d:0b:ed:84:fb 100dBm, does yours show that? It would be very helpful if you could post what ifconfig returns for you. Commented Oct 1, 2012 at 16:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .