Wi-Fi Protected Access client and IEEE 802.1X supplicant
see also :
wpa_cli - wpa_passphrase
[ -BddfhKLqqtuvW ] [ -iifname ] [
-cconfig file ] [ -Ddriver ] [
-PPID_file ] [ -foutput file
add an example, a script, a trick and tips
wpa_supplicant -i wlan0 -c
In most common cases, wpa_supplicant is started with:
wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0
This makes the process fork into background.
The easiest way to debug problems, and to get debug log for bug
reports, is to start wpa_supplicant on foreground with
wpa_supplicant -c/etc/wpa_supplicant.conf -iwlan0 -d
If the specific driver wrapper is not known beforehand, it is
possible to specify multiple comma separated driver wrappers on
the command line. wpa_supplicant will use the first driver
wrapper that is able to initialize the interface.
wpa_supplicant -Dnl80211,wext -c/etc/wpa_supplicant.conf -iwlan0
wpa_supplicant can control multiple interfaces (radios)
either by running one process for each interface separately or by
running just one process and list of options at command line.
Each interface is separated with -N argument. As an example,
following command would start wpa_supplicant for two interfaces:
-c wpa1.conf -i wlan0 -D hostap -N \
-c wpa2.conf -i ath0 -D madwifi
How to connect to a WiFi from command line under Ubuntu without .conf file?
You want a cli command that manages your wpa_suplicant-config?
Have you tried
ifcfg? They handle connection scripts and work for
wifi too but may need some tinkering with.
While using ad-hoc networking, how to I force nodes to use the same cell IDs (bssid)?
I'm trying to connect some Raspberry Pi via ad-hoc mesh network.
And encountered same problem, different cell, or known as "Cell
After days of search, I found this great post:
So I solved this problem and here is my script:
$IFC "$IFACE" down
$IWC "$IFACE" mode managed
$IWC "$IFACE" power off
$IWC "$IFACE" mode ad-hoc channel 10 rts 250 frag 256
$IWC "$IFACE" essid whateveryouwant
$IWC "$IFACE" key off
$IWC "$IFACE" ap 11:22:33:44:55:66
$IFC "$IFACE" up
$IFC "$IFACE" 10.10.10.10/24 up
The command "sudo iwconfig ath0 ap 11:22:33:44:55:66" forces my
ralink5370 into specified cell-id.
Hope this helps.
How should I troubleshoot a problematic wireless connection on Linux?
According to this thread the dongle you bought is not
natively supported and requires the ath9k drivers. Though, that
might be outdated information by now.
Have a look at the ath9k graphical installer. I think should help.
If that doesn't help please give us the output of
wpa_supplicant : Blacklist wireless networks by BSSID
Wire up this code to a command-line option.
I don't think there is any built-in setting to take care of this
but basically you should be able to go to main.c, and wire up a command line option like
BSSIDs separated by semicolons).
To make it persistent you'd have to store it in
wpa_supplicant.conf but it's easy enough to replace
wpa_supplicant with a wrapper that adds your
If you manage to cook up a patch and it seems relatively bug-free
and generally useful, you may want to submit it upstream.
NOTE: Intermediate knowledge of the C programming language is
required to complete this task. If you don't have the knowledge,
you may get better results by asking at another site like
wpa_supplicant for dual WLAN
You create two separate
one for each interface. Then you specify which conf file goes
with which interface when you invoke
You use the
-N option to show that you want to start
describing a new interface.
This example comes right out of the
wpa_supplicant(8) man page:
-c wpa1.conf -i wlan0 -D hostap -N \
-c wpa2.conf -i ath0 -D madwifi
Wpa supplicant suddenly stopped working
Schoolboy error: it turned out that I incidentally installed
network-manager on the system and it interfered with my manual
wpa_supplicant configuration. After removing it everything is
back to normal!
Addressing a host from both internal and external networks
I suppose that you have SOHO hardware router and cannot, for
example, tweak iptables setup on it. In that case, I think the
easiest way is to set up a simple proxying DNS server on SVN
machine (like pdnsd, set it as a DNS server in router
config, then get a dynamic DNS (probably you are already using
one) and map that domain to your local IP address in your local
So when SVN is accessed from outside, your laptop resolves the
domain to external address and your router forwards the
connection; when from inside, the same domain resolves to local
IP and direct connection is estabilished. Moreover, that allows
you to use single SSL certificate valid for that domain if you
Error: "failed to connect to wpa_supplicant - wpa_ctrl_open no such file or directory" using netcfg with wpa_supplicant
You are referencing
incorrectly, due to an outdated wiki entry.
The configuration file for the wpa_supplicant package was moved
to the sub-directory
/etc/wpa_supplicant/ a few
Specify the file as
/etc/wpa_supplicant/wpa_supplicant.conf in your
Where can I find a full list of wpa-* options for the interfaces file?
/etc/wpa_supplicant/functions.sh is what you're
interested in. Look at the
function. In there, look for all of the calls to the
wpa_cli_do function; you're interested in the 4th or
5th argument (if set_argument is the 3rd arg, then you want the
5th) to each call.
Here's a list I extracted quickly from the file with some shell
Where is wpa_supplicant started and how do you change config file (on Debian)?
The scripts responsible for configuring wireless network
interfaces at boot are located in
Each of these directories contains a wpasupplicant file,
which is just a symbolic link to
/etc/wpasupplicant/ifupdown.sh, a script that states, in
# This file is executed by ifupdown in pre-up, post-up, pre-down and
# post-down phases of network interface configuration. It allows
# ifup(8), and ifdown(8) to manage wpa_supplicant(8) and wpa_cli(8)
# processes running in daemon mode.
# /etc/wpa_supplicant/functions.sh is sourced by this file.
There is no reference to wpa_supplicant per se in this file, but
the reference is in functions.sh, the file sourced by
wpasupplicant. It contains the following lines:
start-stop-daemon --start --oknodo $DAEMON_VERBOSITY \
--name $WPA_SUP_PNAME --startas $WPA_SUP_BIN --pidfile $WPA_SUP_PIDFILE \
-- $WPA_SUP_OPTIONS $WPA_SUP_CONF
start-stop-daemon --stop --oknodo $DAEMON_VERBOSITY \
--exec $WPA_SUP_BIN --pidfile $WPA_SUP_PIDFILE
These are the two calls you wish to modify.
wpa_supplicant passphrase, can it be normal password?
It does not have to be configured with
wpa_passphrase. In fact, the very first example of
the Manpage for the wpa_supplicant.conf file is:
1. WPA-Personal (PSK) as home network and WPA-Enterprise with EAP-TLS as work network.
# allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
# home network; allow all valid ciphers
psk="very secret passphrase"
You see that in this case you are free to add your password
in clear text to the file: the
means exactly that, the password is in clear text, and that it
will have to be hashed for it to become a proper PSK.
wpa_passphrase generates that PSK from the ASCII password (and
from the SSID), a step which is automatically performed by
wpa_supplicant when presented with the clear-text password
I would also like to stress that there is no extra security
involved in storing your PSK in clear text or in hashed form, on
your pc. Any half competent attacker grabbing hold of your PSK
will be able t use it to connect to your wifi system, without
even bothering trying to re-construct the original clear-text
form of the password, an impossible and useless task.
The wpa_supplicant system consists of the following
the configuration file describing all networks that the user
wants the computer to connect to.
the program that directly interacts with the network interface.
the client program that provides a high-level interface to the
functionality of the daemon.
a utility needed to construct wpa_supplicant.conf files
that include encrypted passwords.
A summary of available driver backends is below. Support for each
of the driver backends is chosen at wpa_supplicant compile time.
For a list of supported driver backends that may be used with the
-D option on your system, refer to the help output of
wpa_supplicant (wpa_supplicant -h).
(default) Host AP driver (Intersil Prism2/2.5/3). (this can also
be used with Linuxant DriverLoader).
Agere Systems Inc. driver (Hermes-I/Hermes-II).
MADWIFI 802.11 support (Atheros, etc.).
Linux wireless extensions (generic).
Broadcom wl.o driver.
wpa_supplicant wired Ethernet driver
wpa_supplicant Broadcom switch driver
BSD 802.11 support (Atheros, etc.).
Windows NDIS driver.
command line options
Most command line options have global scope. Some are given per
interface, and are only valid if at least one -i option is
specified, otherwise they’re ignored. Option groups for
different interfaces must be separated by -N option.
Optional bridge interface name. (Per interface)
Run daemon in the background.
Path to configuration file. (Per interface)
Path to ctrl_interface socket (Per interface. Only used if
-c is not).
Interface to listen on. Multiple instances of this option can be
present, one per interface, separated by -N option (see
Increase debugging verbosity (-dd even more).
Driver to use (can be multiple drivers: nl80211,wext). (Per
interface, see the available options below.)
-f output file
Log output to specified file instead of stdout.
-g global ctrl_interface
Path to global ctrl_interface socket. If specified, interface
definitions may be omitted.
Include keys (passwords, etc.) in debug output.
Include timestamp in debug messages.
Help. Show a usage message.
Show license (GPL and BSD).
Driver parameters. (Per interface)
Path to PID file.
Decrease debugging verbosity (-qq even less).
Enabled DBus control interface. If enabled, interface definitions
may be omitted.
Wait for a control interface monitor before starting.
Start describing new interface.
interface to pcmcia-cs
interface to pcmcia-cs cardmrg
For example, following small changes to pcmcia-cs scripts can be
used to enable WPA support:
Add MODE="Managed" and WPA="y" to the network scheme in
Add the following block to the end of start action handler
if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
/usr/local/bin/wpa_supplicant -B -c/etc/wpa_supplicant.conf
Add the following block to the end of stop action handler
(may need to be separated from other actions) in
if [ "$WPA" = "y" -a -x /usr/local/bin/wpa_supplicant ]; then
This will make cardmgr start wpa_supplicant when
the card is plugged in.
wpa_supplicant is copyright (c) 2003-2007, Jouni Malinen
<j[:at:]w1[:dot:]fi> and contributors. All Rights Reserved.
This program is dual-licensed under both the GPL version 2 and
BSD license. Either license may be used at your option.
Current hardware/software requirements:
Linux kernel 2.4.x or 2.6.x with Linux Wireless Extensions v15 or
Microsoft Windows with WinPcap (at least WinXP, may work with
Wireless networks do not require physical access to the network
equipment in the same way as wired networks. This makes it easier
for unauthorized users to passively monitor a network and capture
all transmitted frames. In addition, unauthorized use of the
network is much easier. In many cases, this can happen even
without user’s explicit knowledge since the wireless LAN
adapter may have been configured to automatically join any
Link-layer encryption can be used to provide a layer of security
for wireless networks. The original wireless LAN standard, IEEE
802.11, included a simple encryption mechanism, WEP. However,
that proved to be flawed in many areas and network protected with
WEP cannot be consider secure. IEEE 802.1X authentication and
frequently changed dynamic WEP keys can be used to improve the
network security, but even that has inherited security issues due
to the use of WEP for encryption. Wi-Fi Protected Access and IEEE
802.11i amendment to the wireless LAN standard introduce a much
improvement mechanism for securing wireless networks. IEEE
802.11i enabled networks that are using CCMP (encryption
mechanism based on strong cryptographic algorithm AES) can
finally be called secure used for applications which require
efficient protection against unauthorized access.
wpa_supplicant is an implementation of the WPA Supplicant
component, i.e., the part that runs in the client stations. It
implements WPA key negotiation with a WPA Authenticator and EAP
authentication with Authentication Server. In addition, it
controls the roaming and IEEE 802.11 authentication/association
of the wireless LAN driver.
wpa_supplicant is designed to be a "daemon" program that
runs in the background and acts as the backend component
controlling the wireless connection. wpa_supplicant
supports separate frontend programs and an example text-based
frontend, wpa_cli, is included with wpa_supplicant.
Before wpa_supplicant can do its work, the network interface must
be available. That means that the physical device must be present
and enabled, and the driver for the device must be loaded. The
daemon will exit immediately if the device is not already
After wpa_supplicant has configured the network device,
higher level configuration such as DHCP may proceed. There are a
variety of ways to integrate wpa_supplicant into a
machine’s networking scripts, a few of which are described
in sections below.
The following steps are used when associating with an AP using
wpa_supplicant requests the kernel driver to scan
wpa_supplicant selects a BSS based on its configuration
wpa_supplicant requests the kernel driver to associate
with the chosen BSS
If WPA-EAP: integrated IEEE 802.1X Supplicant completes EAP
authentication with the authentication server (proxied by the
Authenticator in the AP)
If WPA-EAP: master key is received from the IEEE 802.1X
If WPA-PSK: wpa_supplicant uses PSK as the master session
wpa_supplicant completes WPA 4-Way Handshake and Group Key
Handshake with the Authenticator (AP)
wpa_supplicant configures encryption keys for unicast and
normal data packets can be transmitted and received
First, make a configuration file, e.g.
/etc/wpa_supplicant.conf, that describes the networks you
are interested in. See wpa_supplicant.conf(5) for details.
Once the configuration is ready, you can test whether the
configuration works by running wpa_supplicant with
following command to start it on foreground with debugging
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -d
Assuming everything goes fine, you can start using following
command to start wpa_supplicant on background without
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -B
Please note that if you included more than one driver interface
in the build time configuration (.config), you may need to
specify which interface to use by including -D<driver name>
option on the command line.
Host AP driver for Prism2/2.5/3 (development
(http://hostap.epitest.fi/) Driver needs to be set in Managed
mode (iwconfig wlan0 mode managed). Please note that
station firmware version needs to be 1.7.0 or newer to work in
(http://www.linuxant.com/driverloader/) with Windows NDIS driver
for your wlan card supporting WPA.
Agere Systems Inc. Linux Driver
(http://www.agere.com/support/drivers/) Please note that the
driver interface file (driver_hermes.c) and hardware specific
include files are not included in the wpa_supplicant
distribution. You will need to copy these from the source package
of the Agere driver.
madwifi driver for cards based on Atheros chip set
(http://sourceforge.net/projects/madwifi/) Please note that you
will need to modify the wpa_supplicant .config file to use the
correct path for the madwifi driver root directory (CFLAGS +=
-I../madwifi/wpa line in example defconfig).
(http://ndiswrapper.sourceforge.net/) with Windows NDIS driver.
Broadcom wl.o driver
This is a generic Linux driver for Broadcom IEEE 802.11a/g cards.
However, it is proprietary driver that is not publicly available
except for couple of exceptions, mainly Broadcom-based
APs/wireless routers that use Linux. The driver binary can be
downloaded, e.g., from Linksys support site
(http://www.linksys.com/support/gpl.asp) for Linksys WRT54G. The
GPL tarball includes cross-compiler and the needed header file,
wlioctl.h, for compiling wpa_supplicant. This driver support in
wpa_supplicant is expected to work also with other devices based
on Broadcom driver (assuming the driver includes client mode
Intel ipw2100 driver
Intel ipw2200 driver
Linux wireless extensions
In theory, any driver that supports Linux wireless extensions can
be used with IEEE 802.1X (i.e., not WPA) when using ap_scan=0
option in configuration file.
Wired Ethernet drivers
BSD net80211 layer (e.g., Atheros driver)
At the moment, this is for FreeBSD 6-CURRENT branch.
The current Windows port requires WinPcap
(http://winpcap.polito.it/). See README-Windows.txt for more
wpa_supplicant was designed to be portable for different drivers
and operating systems. Hopefully, support for more wlan cards and
OSes will be added in the future. See developer.txt for more
information about the design of wpa_supplicant and porting to
other drivers. One main goal is to add full WPA/WPA2 support to
Linux wireless extensions to allow new drivers to be supported
without having to implement new driver-specific interface code in
Supported WPA/IEEE 802.11i features:
WPA with EAP (e.g., with RADIUS authentication server)
("WPA-Enterprise") Following authentication methods are supported
with an integrate IEEE 802.1X Supplicant:
EAP-PEAP/MSCHAPv2 (both PEAPv0 and PEAPv1)
EAP-PEAP/TLS (both PEAPv0 and PEAPv1)
EAP-PEAP/GTC (both PEAPv0 and PEAPv1)
EAP-PEAP/OTP (both PEAPv0 and PEAPv1)
EAP-PEAP/MD5-Challenge (both PEAPv0 and PEAPv1)
LEAP (note: requires special support from the driver for IEEE
(following methods are supported, but since they do not generate
keying material, they cannot be used with WPA or IEEE 802.1X WEP
key management for CCMP, TKIP, WEP104, WEP40
RSN/WPA2 (IEEE 802.11i)