WPA2: (presharedkey = PSK)
a lot of guides out there are incomplete.
it is not easy – you will have to perform a combination of steps.
this was successfully tested on DELL Latitude E4310 with Debian 8.7 „Jessie“
apt-get install wireless-tools wpasupplicant;
# -1. what is your wifi adapter called?
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 IEEE 802.11abgn ESSID:"FRITZ!Box 7490"
Mode:Managed Frequency:2.437 GHz Access Point: 24:65:XX:XX:XX:XX
Bit Rate=1 Mb/s Tx-Power=15 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Link Quality=51/70 Signal level=-59 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:8 Missed beacon:0
# wifi adapter is 'wlan0'
# 0. scan for available wlan/wifi accesspoints
lo Interface doesn't support scanning.
eth0 Interface doesn't support scanning.
wlan1 Scan completed :
Cell 01 - Address: 24:65:11:XX:XX:XX
Frequency:2.437 GHz (Channel 6)
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
IE: IEEE 802.11i/WPA2 Version 1
# you will see a list of reachable WIFI/WLAN networks, take note of the ESSID that you want to connect to (and have the password for)
# 1. checkout what drivers to use
wpa_supplicant; # run this without anything and you will get a little help
Successfully initialized wpa_supplicant
Copyright (c) 2003-2014, Jouni Malinen <firstname.lastname@example.org> and contributors
This software may be distributed under the terms of the BSD license.
See README for more details.
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/)
wpa_supplicant [-BddhKLqqstuvW] [-P<pid file>] [-g<global ctrl>] \
-i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \
[-b<br_ifname>] [-e<entropy file>] [-f<debug file>] \
[-o<override driver>] [-O<override ctrl>] \
[-N -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \
[-m<P2P Device config file>] \
[-p<driver_param>] [-b<br_ifname>] [-I<config file>] ...]
nl80211 = Linux nl80211/cfg80211
wext = Linux wireless extensions (generic)
wired = Wired Ethernet driver
none = no driver (RADIUS server/WPS ER)
# so the available drivers are: nl80211, wext, try both
# 2. generate config file
wpa_passphrase 'FRITZ!Box 7490' '466253308656XXXXXXXX' > /etc/wpa_supplicant/example.conf
# SSID = 'FRITZ!Box 7490'
# 3. try to connect with driver nl80211
wpa_supplicant -B -D nl80211 -i wlan0 -c /etc/wpa_supplicant/example.conf
# if that does not result into:
tail -f /var/log/message; # might help to debug the problem or at least give some clue what is happening
May 2 23:15:28 debian kernel: [ 339.004059] iwlwifi 0000:02:00.0: L1 Enabled - LTR Disabled
May 2 23:15:28 debian kernel: [ 339.010788] iwlwifi 0000:02:00.0: Radio type=0x1-0x3-0x1
May 2 23:15:28 debian kernel: [ 339.223461] iwlwifi 0000:02:00.0: L1 Enabled - LTR Disabled
May 2 23:15:28 debian kernel: [ 339.230173] iwlwifi 0000:02:00.0: Radio type=0x1-0x3-0x1
May 2 23:15:29 debian kernel: [ 339.323003] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
May 2 23:15:32 debian kernel: [ 342.661605] wlan0: authenticate with 24:65:XX:XX:XX:XX
May 2 23:15:32 debian kernel: [ 342.693830] wlan0: send auth to 24:65:XX:XX:XX:XX (try 1/3)
May 2 23:15:32 debian kernel: [ 342.696979] wlan0: authenticated <------ HURRAY!
May 2 23:15:32 debian kernel: [ 342.697142] wlan0: waiting for beacon from 24:65:XX:XX:XX:XX
May 2 23:15:32 debian kernel: [ 342.779710] wlan0: associate with 24:65:XX:XX:XX:XX (try 1/3)
May 2 23:15:32 debian kernel: [ 342.785382] wlan0: RX AssocResp from 24:65:XX:XX:XX:XX (capab=0x431 status=0 aid=3)
May 2 23:15:32 debian kernel: [ 342.793869] wlan0: associated
May 2 23:15:32 debian kernel: [ 342.793914] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
May 2 23:15:32 debian kernel: [ 342.793986] cfg80211: Calling CRDA to update world regulatory domain
# 4. try wext driver
wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant/example.conf
# 5. ifconfig might show an ip6 address now already, but one might also need an ipv4 address
dhclient wlan0; # try to get ipv4 address assigned from dhcp-wifi-router
ping yahoo.com; # should work now
PING yahoo.com (184.108.40.206) 56(84) bytes of data.
64 bytes from ir1.fp.vip.ne1.yahoo.com (220.127.116.11): icmp_seq=1 ttl=49 time=162 ms
64 bytes from ir1.fp.vip.ne1.yahoo.com (18.104.22.168): icmp_seq=2 ttl=49 time=162 ms
64 bytes from ir1.fp.vip.ne1.yahoo.com (22.214.171.124): icmp_seq=3 ttl=49 time=163 ms
wireless-tools – This package contains the Wireless tools, used to manipulate the Linux Wireless Extensions. The Wireless Extension is an interface allowing you to set Wireless LAN specific parameters and get the specific stats.
wpasupplicant – WPA and WPA2 are methods for securing wireless networks, the former using IEEE 802.1X, and the latter using IEEE 802.11i. This software provides key negotiation with the WPA Authenticator, and controls association with IEEE 802.11i networks.
1. become root by su or sudo bash
2. ifconfig wlan0 up
3. iwlist wlan0 scan
scans for available betworks
4. iwconfig wlan0 essid AccessPointName
if it is encrypted wifi
iwconfig wlan0 essid AccessPointName key s:YourWifiPassword
With this in mind it’s crucially important to point out that iwconfig does not support WPA/WPA2 negotiation & authentication when connecting to a wlan network. That is to say the only wifi networks you can connect to with iwconfig are open unencrypted networks and WEP enabled networks.
Now the reason you’re getting this strange error:
Error for wireless request "Set Encode" (8B2A) :
SET failed on device wlan0 ; Invalid argument.
is because iwconfig is expecting a WEP-key for the key: parameter. Because of the way WEP works, this key has to meet one of these conditions:
- ascii string that’s exactly 5 characters in length
- ascii string that’s exactly 13 characters in length
- hexidecimal string that’s exactly 10 characters in length
- hexidecimal string that’s exactly 26 characters in length