hostapd_cli使用手册

更新时间:2023-06-10 01:25:14 阅读: 评论:0

hostapd_cli使⽤⼿册
hostapd_cli ⽆线AP⼯具
SylixOS hostapd_cli 软件介绍
1、功能介绍
hostapd_cli 是⼀款⽤作⽆线 AP 功能的客户端程序。它需要与 hostapd 主程序配置使⽤。hostapd 的使⽤可以参考 《hostapd 使⽤⼿册》。
注:本篇⽂档均是针对 SylixOS 下的 hostapd_cli 的使⽤说明。
2、⼯具使⽤
hostapd_cli 的编译
hostapd_cli ⽤于设置或修改hostapd的相关服务,因此其源码就在 hostapd ⼯程中。在SylixOS下,如果需要编译hostapd_cli,只需要将 hostapd ⼯程根⽬录中 deconfig ⽂件⾥ CONFIG_COMPILE_CLI=y 注释掉,那么编译出来的就是hostapd_cli,否则就是hostapd。如下图所⽰:
注意事项:
要启动 hostapd_cli ,就必须先在 hostapd 的配置⽂件中,指定好⼀个控制接⼝的路劲。即需要在配置⽂件中,对 ctrl_interface 进⾏设置
主要流程:
hostapd_cli 作为 hostapd 的客户端,使⽤时,⾸先需要先启动 hostapd 主程序。hostapd 启动后,运⾏ cli 客户端时,会⾃动去连接当前正在⼯作的 hostapd 进程,连接成功后,cli 客户端就可以对 hostapd 应⽤程序进⾏参数的获取和控制。
1. 配置⽅式⼀: shell 交互⽅式
使⽤此⽅式,可以借助 hostapd_cli 提供的交互命令与 hostapd 进⾏通信,从⽽获取当前 AP 的状态,或者对 AP 的配置进⾏动态修改。这种⽅式的启动,⽆需跟任何参数,直接运⾏ hostapd_cli 即可。如下所⽰:
[root@sylixos:/root]#
[root@sylixos:/root]# hostapd_cli
hostapd_cli v2.9
Copyright (c)2004-2019, Jouni Malinen <j@w1.fi> and contributors
This software may be distributed under the terms of the BSD licen.
See README for more details.
Selected interface 'wl3'
Interactive mode
>
>
>
>
2. 配置⽅式⼆:带参数运⾏
如果不想使⽤第⼀种 shell 交互式的操作,则可以使⽤带参数运⾏ hostapd_cli 的⽅式去使⽤ hostapd_cli。如想要修改 ssid ,那在使⽤第⼀种⽅式时,操作如下:
如果使⽤第⼆种⽅式,那么可以直接跟上需要配置的内容作参数即可,使⽤⽅法如下:
3、hostapd_cli 常⽤ AP 操作
hostapd 可以使⽤ t 命令,在 hostapd 启动后,对 hostapd 配置⽂件,即 f
内所有的配置项进⾏配置,从⽽实现动态修改配置的⽬的。
注意:
使⽤ t 命令进⾏修改时,修改的内容是对应的内存⾥变量的内容,并不是修改 hostapd 配置⽂件的内容,因此在使⽤ t 命令完成所有的配置修改后,需要使⽤ reload 命令将这些配置重新加载。
有些配置内容即使按照 t 、reload 配置后,也是⽆法更新的。⽐如隐藏 ssid 功能,此时需要再 t 命令配置完成后,先使⽤ disable 命令,禁⽤ hostapd,然后再使⽤ enable 启动 hostapd,从⽽实现配置更新。
以下是常⽤的⼀些 AP 配置操作,本节借助第⼆种⽅式进⾏配置说明:
修改⽆线热点名称
[root@sylixos:/root]# hostapd_cli t ssid Test
Selected interface 'wl3'
OK
[root@sylixos:/root]# hostapd_cli reload
Selected interface 'wl3'
OK
配置内容:修改 ssid 为 “Test”
修改⽆线密码
[root@sylixos:/root]# hostapd_cli t wpa_passphra 12345678
Selected interface 'wl3'
OK
[root@sylixos:/root]# hostapd_cli reload
Selected interface 'wl3'
OK
配置内容:修改密码为 “12345678”
设置 AP 热点 channel
[root@sylixos:/root]# hostapd_cli t channel 11
Selected interface 'wl3'
OK
[root@sylixos:/root]# hostapd_cli reload
Selected interface 'wl3'
OK
配置内容:修改通道为 11
设置 AP 热点隐藏
[root@sylixos:/root]# hostapd_cli t ignore_broadcast_ssid 1
Selected interface 'wl3'
OK
[root@sylixos:/root]# hostapd_cli disable
Selected interface 'wl3'
仔细阅读OK
[root@sylixos:/root]# hostapd_cli enable
Selected interface 'wl3'
OK
配置内容:修改 ignore_broadcast_ssid 属性为 1(或者为 2),则会隐藏当前的 ssid,这⾥不能使⽤
reload 去重新加载配置,因为隐藏 ssid 需要做更多的操作修改,因此这⾥先使⽤ disable 关闭 hostapd,然后再使⽤ enable 使能 hostapd,从⽽实现隐藏功能。
注意:上述修改均不会修改 f 配置⽂件
当然对于热点的 ssid 密码及加密⽅式,也有⼀种⽅式可以设置完后,⾃动修改 f ,其shell 交互操作如下:
> help
commands:
ping = pings hostapd
mib = get MIB variables (dot1x, dot11, radius)高新技术产业发展
relog = reload/truncate debug log output file
status = show interface status info
sta <addr> = get MIB variables for one station
all_sta = get MIB variables for all stations
list_sta = list all stations
new_sta <addr> = add a new station
烧仙草奶茶
deauthenticate <addr> = deauthenticate a station
disassociate <addr> = disassociate a station
sa_query <addr> = nd SA Query to a station
wps_pin <uuid> <pin> [timeout] [addr] = add WPS Enrollee PIN
wps_check_pin <PIN> = verify PIN checksum
wps_pbc = indicate button pushed to initiate PBC
wps_cancel = cancel the pending WPS operation
wps_nfc_tag_read <hexdump> = report read NFC tag with WPS data
wps_nfc_config_token <WPS/NDEF> = build NFC configuration token
wps_nfc_token <WPS/NDEF/enable/disable> = manager NFC password token  wps_ap_pin <cmd> [params..] = enable/disable AP PIN
wps_config <SSID> <auth> <encr> <key> = configure AP
wps_get_status = show current WPS status
disassoc_imminent = nd Disassociation Imminent notification
ess_disassoc = nd ESS Dissassociation Imminent notification
bss_tm_req = nd BSS Transition Management Request
get_config = show current configuration
help = show this usage help
interface [ifname] = show interfaces/lect interface
raw <params..> = nd unprocesd command
level <debug level> = change debug level
licen = show full hostapd_cli licen
quit = exit hostapd_cli
t <name> <value> = t runtime variables
get <name> = get runtime info
t_qos_map_t <arg,arg,...> = t QoS Map t element
nd_qos_map_conf <addr> = nd QoS Map Configure frame
chan_switch <cs_count> <freq> [c_channel_offt=] [center_freq1=]
[center_freq2=] [bandwidth=] [blocktx] [ht|vht]
= initiate channel switch announcement
hs20_wnm_notif <addr> <url>
= nd WNM-Notification Subscription Remediation Request
hs20_deauth_req <addr> <code (0/1)> <Re-auth-Delay(c)> [url]
= nd WNM-Notification imminent deauthentication indication
vendor <vendor id> <sub command id> [<hex formatted data>]
= nd vendor driver command
enable = enable hostapd on current interface
reload = reload configuration for current interface
disable = disable hostapd on current interface
erp_flush = drop all ERP keys
log_level [level] = show/change log verbosity level
pmksa  = show PMKSA cache entries
pmksa_flush  = flush PMKSA cache
t_neighbor <addr> <ssid=> <nr=> [lci=] [civic=] [stat]
= add AP to neighbor databa
remove_neighbor <addr> <ssid=> = remove AP from neighbor databa
req_lci <addr> = nd LCI request to a station
req_range  = nd FTM range request
driver_flags  = show supported driver flags
accept_acl =Add/Delete/Show/Clear accept MAC ACL
deny_acl =Add/Delete/Show/Clear deny MAC ACL
poll_sta <addr> = poll a STA to check connectivity with a QoS null frame
>
>
>
此时,这些命令⾥ wps_config 命令可以⽤于修改⽆线热点的名称,密码和加密⽅式。命令格式如下:
hostapd_cli wps_config <new SSID><auth><encr><new key>
examples:
hostapd_cli wps_config testing WPA2PSK CCMP 12345678亚里士多德名言
hostapd_cli wps_config "no curity" OPEN NONE ""
<auth> must be one of the following: OPEN WPAPSK WPA2PSK WPAPSKALL
<encr> must be one of the following: NONE WEP TKIP CCMP
注意, WPAPSKALL 是 SylixOS 添加的,原始版本的 hostapd_cli 只⽀持 wpa 和 wpa2,即对应 f ⽂件中的 wpa 参数只能设置为 1 和 2, 不能设置为 3。⽽在 Spirit 产品中,需要让 AP
同时⽀持 wpa 和 wpa2,因此此处添加了 WPAPSKALL 这个选项
综上,在 hostapd_cli 的命令⾏界⾯⾥可以使⽤如下命令修改 ssid 和密码,如下命令会将 hostapd 开启的⽆线热点的名称和密码分别修改成:EdgerOS 和 987654321。其加密信息为 CCMP 的 WPA2PSK 加密。
>wps_config EdgerOS WPA2PSK CCMP 987654321
当然,如果只想借助 hostapd_cli 修改⼀下 ssid 和密码,不想进⼊其命令操作界⾯,那么也可以直接在 hostapd_cli 启动时跟上⾯的命令即可,此时 hostapd_cli 只会去配置 ssid 和密码,不会进⼊命令⾏界⾯,操作如下:
[root@sylixos:/root]# hostapd_cli wps_config testAP WPAPSKALL CCMP 12345678
实时获取⽆线热点相关状态信息
获取⽆线热点信息以及相关状态有两种⽅式:
最常见的⼀种就是使⽤ hostapd_cli 提供的相关命令来获取,⽐如 status ,get_config 等命令。具体使⽤⽅法,可以参考上⼀节内容。
晚上用英语怎么说以下是 使⽤这两个命令,获取到的⼀个⽆线信息:
> status
state=ENABLED
phy=phy0
freq=2462
num_sta_non_erp=0
num_sta_no_short_slot_time=0
num_sta_no_short_preamble=0
olbc=0
num_sta_ht_no_gf=0
num_sta_no_ht=0
num_sta_ht_20_mhz=0
num_sta_ht40_intolerant=0
olbc_ht=0
ht_op_mode=0x0
cac_time_conds=0
cac_time_left_conds=N/A
channel=11
condary_channel=0
言简意赅是什么意思
ieee80211n=1
ieee80211ac=0
beacon_int=100
写信格式图片
dtim_period=2
ht_caps_info=000e
ht_mcs_bitmask=ffff0000000000000000
supported_rates=02 04 0b 16 0c 12 18 24 30 48 60 6c
max_txpower=20
bss[0]=wl3
bssid[0]=20:32:33:59:28:04
ssid[0]=EdgerOS
num_sta[0]=1do

本文发布于:2023-06-10 01:25:14,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/915647.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:修改   配置   内容   命令   热点   需要
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图