wpa_cli 连接 wifi(转)
wpa_cli 连接 wifi
use the following command:
wpa_supplicant -Dwext -iwlan0 -C/data/system/wpa_supplicant -c/data/misc/wifi/wpa_supplicant.conf
2: Run the command line tool wpa_cli to connect wifi
wpa_cli -p/data/system/wpa_supplicant -iwlan0
Then , it will let you set network interactively
some common command:
>scan = to scan the neighboring AP
>scan_results = show the scan results
>status = check out the current connection information
>terminate = terminate wpa_supplicant
>quit = exit wpa_cli
>add_network = it will return a network id to you
>set_network <network id> <variable> <value> = set network variables (shows list of variables when run without arguments), success will return OK, or will return Fail
>select_network <network id> = select a network (disable others)
>disable_network <network id> = disable a network
>enable_network <network id> = enable a network
> set_network 0 priority 0
> list_network
> save_config
3: example
for AP that doesn`t have encryption
>add_network (It will display a network id for you, assume it returns 0)
>set_network 0 ssid “666”
>set_network 0 key_mgmt NONE
>enable_network 0
>quit
if normal, we have connectted to the AP “666”, now you need a IP to access internet, for example:
dhcpcd wlan0
if everything is ok, it will get an IP & can access internet
for AP that has WEP
>add_network (assume returns 1)
>set_network 1 ssid “666”
>set_network 1 key_mgmt NONE
>set_network 1 wep_key0 “your ap passwork”(if usting ASCII, it need double quotation marks, if using hex, then don`t need the double quotation marks)
>set_network 1 wep_tx_keyidx 0
>select_network 1 (optional, remember, if you are connecting with another AP, you should select it to disable the another)
>enable_network 1
and then ,get an IP to access internet
for AP that has WPA-PSK/WPA2-PSK
>add_network (assume returns 2)
>set_network 2 ssid “666”
>set_network 2 psk “your pre-shared key”
>select_network 2 (optional, remember, if you are connecting with another AP, you should select it to disable the another)
>enable_network 2
there is still some others options to be set, but wpa_supplicant will choose the default for you, the default will include all we need to set and then ,get an IP to access internet
命令执行后,wpa_cli 会输出连接的过程信息。如果一切正确,则最后后输出:
<2>CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed (reauth) [id=0 id_str=]
获取IP地址
用 quit
命令退出wpa_cli 。然后用
dhclient wlan0
命令获取IP地址。
wpa_cli 连接 wifi(转)的更多相关文章
- wpa_cli 连接 wifi
转自:http://hi.baidu.com/yyangjjun/item/9dfe8e175439fc7a1009b5ba 1: run wpa_supplicant first use the ...
- linux下使用shell命令通过wpa_cli控制wpa_supplicant连接wifi
最近在调试wifi,已经把wpa_supplicant 工具编译打包好了,为了测试wif驱动及wifi模块是否ok,需要用shell命令临时启动wifi服务连接wifi热点测试. 首先板子启动用ifc ...
- Hi3516如何连接Wifi(二)
目录: 一.总体思路 二.启动Daemon 三.作者文章合集 书承上回(Hi3516如何连接Wifi(一)),上一篇聊了一下怎样在Hi3516中用wpa_supplicant连接到Wifi热点,本文讲 ...
- Linux 使用wpa_supplicant手动配置连接wifi
Linux 使用wpa_supplicant手动配置连接wifi wpa_supplicant 简介 wpa_supplicant是Linux BSD, Mac OSX和Windows的WPA的服务, ...
- 树莓派 连接wifi与路由器ip绑定
先推荐几个手机软件 在酷安网里应该能找到 1.JuiceSSH 橘子ssh软件 手机连上路由器 就可以控制局域网内的树莓派 2.VNC Viewer 远程桌面软件VNC 也是连接局域网的树莓派 ...
- 树莓派连接wifi
使用树莓派,通过无线网卡连接wifi,再通过远程桌面或者ssh的连接树莓派比较方便,本文记录树莓派wifi如何设置. 参考链接: http://www.jianshu.com/p/b42e8d3df4 ...
- 手机连接wifi自动弹窗的原理及其实现方案
一.手机连上wifi后会自动弹窗的原理 生活中,有很多需要认证的路由器,手机连接wifi热点后会自动弹出一个网页,让用户输入账号和密码,比如星巴克,肯地基,麦当劳,甚至是火车站和机场的候车室.其实这是 ...
- android开发连接wifi addNetwork 返回-1
如下代码:(注释掉的是会返回-1的代码,未注释的是能够正常连接wifi的代码) // public WifiConfiguration CreateWifiInfo(String SSID, Stri ...
- 为什么手机连接wifi会显示已停用?
1.通常导致手机连接WiFi显示“已停用”故障的原因是由于无线路由器“安全模式”设置不当造成的,对此我们可以通过以下方法来解决: 2.根据无线路由器背面的信息(包括路由器IP地址,登陆用户名和密码), ...
随机推荐
- mysql DATE_FORMAT(date, format) 函数
DATE_FORMAT(date, format) 函数用法 DATE_FORMAT(date, format) 函数根据format字符串格式化date值. 1.把字符串转为日期格式 实例: SEL ...
- jquery的功能函数
1.$.boxModel <!DOCTYPE html> <html> <head> <script src="/jquery/jquery-1.1 ...
- firefox篇
QQ:1187362408 欢迎技术交流和学习 firefox篇(firefox): TODO: 一,firefox:使用总结例如以下: 运用filefox调试, 总结例如以下: 1.加入fire ...
- iOS: iOS各种设备信息获取
Author:si1ence Link:http://www.jianshu.com/p/b23016bb97af 为了统计用户信息.下发广告,服务器端往往需要手机用户设备及app的各种信息,下面讲述 ...
- 如何为Failover Cluster添加Quorum disk
无废话, 上图.
- 【云计算】使用docker搭建nfs实现容器间共享文件
首先介绍下今天的两个主角:nfs和docker nfs 是什么 NFS(Network File System)即网络文件系统,是FreeBSD支持的文件系统中的一种,它允许网络中的计算机之间通过TC ...
- CarbonData编译与安装
原文连接 http://xiguada.org/carbondata_compile/ CarbonData是啥? CarbonData is a fully indexed columnar and ...
- Linux 监测内存常用的工具sar free vmstat
Linux 检测内存常用的工具sar free vmstat free 内存统计信息解释 total 内存总量used 内存使用的大小free 内存剩余大小shared 共享内存大小buffers 块 ...
- 塔防游戏 代码project as 分享
分享 用到的技术为 1. 先进的下载技术 2. mvc 游戏仅仅实现战斗逻辑功能. 简单的 登陆,及选择关卡,战斗,结算. 五脏俱全,各种游戏模块及分层都划分清楚,仅仅要填代码就能够了 哈哈 能够拿 ...
- 〖Linux〗Debian 7.1.0 Wheezy使用ltib报错的解决办法
报错内容: scue@Link:/home/work/ltib$ ./ltib Processing platform: Phytec board with the NXP LPC32XX SoC = ...