wpa_supplicant 的使用

简介: wpa_supplicant 的使用


  • 概述

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参数
#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 &


目录
相关文章
|
监控 数据可视化 Ubuntu
|
10月前
|
Linux 数据安全/隐私保护
使用Linux命令行接入无线网络Wi-Fi的示例。
现在,你已经使用命令行成功地连接到 Wi-Fi 网络了。这两个示例涵盖了用 `nmcli` 和 `wpa_supplicant` 连接无线网络的常见场景,让你能够不依赖图形化界面来完成这个任务。在日常使用中熟练掌握这些基本操作能增强你对 Linux 系统的理解,帮助你更有效地处理各种问题。
835 12
|
前端开发 安全 数据安全/隐私保护
WPA_CLI 的介绍:介绍如何使用wpa_cli连接WiFi的方法
WPA_CLI 的介绍:介绍如何使用wpa_cli连接WiFi的方法
1688 2
|
Android开发
不写一行代码(二):实现安卓基于PWM的LED设备驱动
本文介绍了在Android系统中不编写任何代码,通过设备树配置和内核支持的通用PWM LED驱动来实现基于PWM的LED设备驱动,并通过测试命令调整LED亮度级别。
521 0
不写一行代码(二):实现安卓基于PWM的LED设备驱动
|
Unix Linux 数据处理
Linux命令stty详解
`stty`是Linux命令,用于设置和查看终端参数,如波特率、字符处理和控制字符。它直接与终端驱动交互,支持多种选项以适应不同的配置需求。例如,`stty -a`显示当前设置,`stty -echo`关闭回显,`stty 115200 cs8`调整波特率和字符大小。注意修改设置可能影响终端行为,建议先备份(`stty -g`)并谨慎操作。查阅手册页以获取详细信息。
|
Dragonfly 安全 算法
|
Ubuntu Linux 测试技术
探索Linux中的`dbus-send`命令
`dbus-send`是Linux中用于进程间通信的D-Bus系统的命令行工具,允许应用程序通过消息总线相互交互。要安装它,可以使用包管理器(如`apt-get`或`dnf`)。基本语法包括指定总线类型、目标服务、消息类型、对象路径、接口及方法等。示例用法包括使用`dbus-send`来锁定屏幕(通过调用`org.gnome.ScreenSaver.Lock`)和设置音量(通过与PulseAudio服务交互)。在使用时,需了解目标服务的接口和方法,并确保具备相应权限。
993 10
|
安全 网络安全 数据安全/隐私保护
|
Unix Shell Linux
linux互斥锁(pthread_mutex)知识点总结
linux互斥锁(pthread_mutex)知识点总结
|
Linux 编译器 网络安全
嵌入式Linux移植dropbear
嵌入式Linux移植dropbear
1143 3