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 &


目录
相关文章
|
存储 缓存 物联网
uboot 启动流程详细分析参考
uboot 启动流程详细分析参考
2600 1
|
监控 数据可视化 Ubuntu
|
Linux 数据安全/隐私保护
使用Linux命令行接入无线网络Wi-Fi的示例。
现在,你已经使用命令行成功地连接到 Wi-Fi 网络了。这两个示例涵盖了用 `nmcli` 和 `wpa_supplicant` 连接无线网络的常见场景,让你能够不依赖图形化界面来完成这个任务。在日常使用中熟练掌握这些基本操作能增强你对 Linux 系统的理解,帮助你更有效地处理各种问题。
1262 12
|
前端开发 安全 数据安全/隐私保护
WPA_CLI 的介绍:介绍如何使用wpa_cli连接WiFi的方法
WPA_CLI 的介绍:介绍如何使用wpa_cli连接WiFi的方法
2157 2
|
Linux
【Linux命令200例】diff比较两个文件的差异
diff命令是Linux系统中的一个非常实用且常用的命令。它用于比较两个文件的差异,并输出不同之处的详细说明。diff命令可以帮助我们快速找出两个文件之间的差异,从而方便我们进行文件对比、合并和版本控制等操作。
2033 0
|
Dragonfly 安全 算法
|
Ubuntu Linux 测试技术
探索Linux中的`dbus-send`命令
`dbus-send`是Linux中用于进程间通信的D-Bus系统的命令行工具,允许应用程序通过消息总线相互交互。要安装它,可以使用包管理器(如`apt-get`或`dnf`)。基本语法包括指定总线类型、目标服务、消息类型、对象路径、接口及方法等。示例用法包括使用`dbus-send`来锁定屏幕(通过调用`org.gnome.ScreenSaver.Lock`)和设置音量(通过与PulseAudio服务交互)。在使用时,需了解目标服务的接口和方法,并确保具备相应权限。
1297 10
|
Ubuntu 虚拟化
Ubuntu——VMware安装后网络提示线缆已拔除
Ubuntu——VMware安装后网络提示线缆已拔除
679 0
|
Linux 编译器 网络安全
嵌入式Linux移植dropbear
嵌入式Linux移植dropbear
1540 3