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

21,092

Solution 1

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'.

Solution 2

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:

http://vinci.wordpress.com/2008/10/16/using-wpa-on-openbsd/

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)

and

http://www.openbsd.org/cgi-bin/man.cgi?query=ral&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html

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

    # ifconfig ral0 nwid my_net wpakey my_passphrase
Share:
21,092

Related videos on Youtube

gasko peter
Author by

gasko peter

Updated on September 18, 2022

Comments

  • gasko peter
    gasko peter almost 2 years

    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 :D

    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. :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 :)

    • Admin
      Admin almost 12 years
      wpa_supplicant doens't work for you?
    • Admin
      Admin almost 12 years
      but how?? :) what are the exact commands? :O
    • Admin
      Admin almost 12 years
      What wireless network adapter are you using?
  • AshMv
    AshMv over 11 years
    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?
  • gasko peter
    gasko peter over 11 years
    "ifconfig ath0" displayed 802.11 information, but it didn't displayed IP address :)
  • AshMv
    AshMv over 11 years
    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.
  • Salil
    Salil over 11 years
    @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.