How to permanently connect to WPA2AES wifi with OpenBSD (through cli)

openbsdwifi

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"

UPDATE#2:

DHCP NWID SSID wpakey SSIDPWD

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

UPDATE#3:

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

gived:

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

UPDATE#4:

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 😀

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

UPDATE#6:

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. 😀 I only have the motherboard of the eee pc 701 and the wifi card in it.. 😀 with NO ANTENNAS 😀 – so I will try to find an antenna 🙂

Best Answer

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

/etc/hostname.iwn0

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,

ifconfig

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

Related Question