wpa_supplicant是wifi客户端(client)加密认证工具,
和iwconfig不同,wpa_supplicant支持wep、wpa、wpa2等完整的加密认证,而iwconfig只能支持wep。
和wpa_supplocant相对应的,ap端的加密认证工具为hostapd。
wpa_supplicant运行于后台,它需要借助控制台工具wpa_cli来进行手动操作
在wpa_supplicant源码目录下,存在参考的配置文件wpa_supplicant.conf,几乎包含里所有的配置项。
我们的配置文件不需要这么复杂,开始测试阶段,我只写最简单的配置文件,其它手动操作先。
在/etc/下建立配置文件wpa_supplicant.conf,内容如下:
ctrl_interface=/var/run/wpa_supplicant update_config=1 #其中,update_config=1使能配置更改。
#wpa_supplicant --help usage: wpa_supplicant [-BddhKLqqtuvW] [-P<pid file>] [-g<global ctrl>] \ [-G<group>] \ -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \ [-b<br_ifname>] [-e<entropy file>] \ [-o<override driver>] [-O<override ctrl>] \ [-N -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \ [-p<driver_param>] [-b<br_ifname>] [-I<config file>] ...] drivers: nl80211 = Linux nl80211/cfg80211 wext = Linux wireless extensions (generic) hostap = Host AP driver (Intersil Prism2/2.5/3) wired = Wired Ethernet driver options: -b = optional bridge interface name -B = run daemon in the background -c = Configuration file -C = ctrl_interface parameter (only used if -c is not) -i = interface name -I = additional configuration file -d = increase debugging verbosity (-dd even more) -D = driver name (can be multiple drivers: nl80211,wext) -e = entropy file -g = global ctrl_interface -G = global ctrl_interface group -K = include keys (passwords, etc.) in debug output -t = include timestamp in debug messages -h = show this help text -L = show license (BSD) -o = override driver parameter for new interfaces -O = override ctrl_interface parameter for new interfaces -p = driver parameters -P = PID file -q = decrease debugging verbosity (-qq even less) -u = enable DBus control interface -v = show version -W = wait for a control interface monitor before starting -N = start describing new interface example: wpa_supplicant -Dnl80211 -iwlan0 -c /etc/wpa_supplicant.conf -dd >/var/wifi_log &”
其中最常用的为:-i 指定端口,-c 指定配置文件,-D 指定使用的wifi驱动
我们这里只指定端口和配置文件,驱动使用默认的。
wpa_supplicant启动操作命令
wpa_supplicant -i ath0 -c /etc/wpa_supplicant.conf &