最近要用到wpa_supplicant,但是在网上查询了一下,很多都是关于wpa_supplicant的开发,很少涉及到使用方面,个人通过各种资料总结和试验了一番。
工具/原料
-
linux
方法/步骤
-
命令格式:
wpa_supplicant [-BddhKLqqstuvW] [-P<pid file>] [-g<global ctrl>] \
-i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-p<driver_param>] \
[-b<br_ifname>] [-f<debug file>] \
[-o<override driver>] [-O<override ctrl>] \
[-N -i<ifname> -c<conf> [-C<ctrl>] [-D<driver>] \
[-p<driver_param>] [-b<br_ifname>] ...]
-
驱动(一般常使用的就是wext):
wext = Linux wireless extensions (generic)
hostap = Host AP driver (Intersil Prism2/2.5/3)
atmel = ATMEL AT76C5XXx (USB, PCMCIA)
wired = Wired Ethernet driver
-
各个选项及其含义:
-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
网口名称
-d = increase debugging verbosity (-dd even more)
增加调试信息输出
-D = driver name (can be multiple drivers: nl80211,wext)
驱动名称
-g = global ctrl_interface
全局网口配置
-K = include keys (passwords, etc.) in debug output
在debug输出中包含keys
-t = include timestamp in debug messages
将各个debug信息前输出时间标签
-h = show this help text
显示帮助信息
-L = show license (GPL and BSD)
显示license
-o = override driver parameter for new interfaces
覆盖driver参数
-O = override ctrl_interface parameter for new interfaces
覆盖ctrl_interface参数
-p = driver parameters
携带驱动参数
-P = PID file
进程文件
-q = decrease debugging verbosity (-qq even less)
在debug中不输出指定参数
-v = show version
显示版本信息
-W = wait for a control interface monitor before starting
启动前等待控制接口
-N = start describing new interface
启动对新接口的描述
-
命令举例:
wpa_supplicant -d -Dwext -i wlan0 -c /data/misc/wifi/wpa_supplicant.conf -t -d /data/misc/wifi/log.txt
使用linux通用驱动,网络接口为wlan0,读取文件为/data/misc/wifi/wpa_supplicant.conf, 输出带时间戳的调试信息到/data/misc/wifi/log.txt中,执行无线配置