wpa_supplicant移植安装
2016-04-28 20:35
232 查看
前面讲了iw工具的使用,这篇文章来讲解wpa_supplicant工具的安装和使用
用到的源码:
openssl-1.0.1d.tar.gz,
下载地址:点击这里!
wpa_supplicant-2.0.tar.gz 下 载地址:点击这里!
以手机上WIFI热点为例,有4种常用的"认证/加密"
a. open
b. WEP
c. WPA(TKIP)
d. WPA2(AES)
wpa_supplicant : 可用于上述4种"认证/加密"
需要用到libopenssl库文件,先编译它的依赖libopenssl
tar xzf openssl-1.0.1d.tar.gz
cd openssl-1.0.1d/
./config shared no-asm --prefix=$PWD/tmp
修改Makefile:
CC= arm-linux-gcc
AR= arm-linux-ar $(ARFLAGS) r
RANLIB= arm-linux-ranlib
NM= arm-linux-nm
MAKEDEPPROG= arm-linux-gcc
make
make install
/* 把tmp目录头文件和库文件放在交叉工具链路径下,并且库文件复制到根文件系统的lib */
把编译出来的头文件应该放入:/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include
把编译出来的库文件应该放入:/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib
把编译出来的库文件应该放入根文件系统的lib目录:
编译wpa_supplicant-2.0.tar.gz
tar xzf wpa_supplicant-2.0.tar.gz
cd wpa_supplicant-2.0/wpa_supplicant/
cp defconfig .config
修改.config加上一行: CONFIG_LIBNL32=y /* 不加提示找不到-lnl库 */
修改Makefile:
CC=arm-linux-gcc
make
make DESTDIR=$PWD/tmp install
把wpa_supplicant/examples/plaintext.conf配置文件复制到开发板的etc目录下
启动开发板用下面的命令:
mkdir -p /var/run/wpa_supplicant
① OPEN
wpa_supplicant -B -c/etc/plaintext.conf -iwlan0
wpa_cli -iwlan0 status // 查看状态
ifconfig wlan0 172.168.1.55 /* 无线网卡的IP */
ping 172.168.1.1 /* 无线网卡的网关 */
配置文件内容为:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="Linux"
key_mgmt=NONE
}
② WEP/WEP
wpa_supplicant -B -c/etc/wep.conf -iwlan0
wpa_cli -iwlan0 status // 查看状态
ifconfig wlan0 192.168.1.55
ping 192.168.1.1
配置文件:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="Linux"
key_mgmt=NONE
wep_key0="Linux"
wep_tx_keyidx=0
}
③WPA(TKIP)
wpa_supplicant -B -c/etc/wpa-psk-tkip.conf -iwlan0
wpa_cli -iwlan0 status // 查看状态
ifconfig wlan0 192.168.1.55
ping 192.168.1.1
配置文件
ctrl_interface=/var/run/wpa_supplicant # 一个目录,用于wpa_supplicant和wpa_cli的socket通信
network={
ssid="Linux"
proto=WPA # proto: list of accepted protocols, 可取WPA,RSN
# If not set, this defaults to: WPA RSN
key_mgmt=WPA-PSK # 认证方式
# If not set, this defaults to: WPA-PSK WPA-EAP
pairwise=TKIP # If not set, this defaults to: CCMP TKIP
group=TKIP # If not set, this defaults to: CCMP TKIP WEP104 WEP40
psk="Linux" /* 密码 */
}
④ WPA2(AES)
wpa_supplicant -B -c/etc/wpa_wpa2.conf -iwlan0
wpa_cli -iwlan0 status // 查看状态
ifconfig wlan0 192.168.1.55
ping 192.168.1.1
配置文件:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="Linux"
psk="Linux"
}
另:
wpa_cli可工作于"命令模式"和"交互模式"
⑤ 配置文件里设置多个network:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="Linux"
psk="baiwenwang123"
}
network={
ssid="Linux1"
psk="Linux"
}
⑥ 访问外网:
修改/etc/resolv.conf添加DNS:
nameserver 192.168.1.1
设置网关:
route add default gw 192.168.1.1
用到的源码:
openssl-1.0.1d.tar.gz,
下载地址:点击这里!
wpa_supplicant-2.0.tar.gz 下 载地址:点击这里!
以手机上WIFI热点为例,有4种常用的"认证/加密"
a. open
b. WEP
c. WPA(TKIP)
d. WPA2(AES)
wpa_supplicant : 可用于上述4种"认证/加密"
需要用到libopenssl库文件,先编译它的依赖libopenssl
tar xzf openssl-1.0.1d.tar.gz
cd openssl-1.0.1d/
./config shared no-asm --prefix=$PWD/tmp
修改Makefile:
CC= arm-linux-gcc
AR= arm-linux-ar $(ARFLAGS) r
RANLIB= arm-linux-ranlib
NM= arm-linux-nm
MAKEDEPPROG= arm-linux-gcc
make
make install
/* 把tmp目录头文件和库文件放在交叉工具链路径下,并且库文件复制到根文件系统的lib */
把编译出来的头文件应该放入:/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include
把编译出来的库文件应该放入:/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib
把编译出来的库文件应该放入根文件系统的lib目录:
编译wpa_supplicant-2.0.tar.gz
tar xzf wpa_supplicant-2.0.tar.gz
cd wpa_supplicant-2.0/wpa_supplicant/
cp defconfig .config
修改.config加上一行: CONFIG_LIBNL32=y /* 不加提示找不到-lnl库 */
修改Makefile:
CC=arm-linux-gcc
make
make DESTDIR=$PWD/tmp install
把wpa_supplicant/examples/plaintext.conf配置文件复制到开发板的etc目录下
启动开发板用下面的命令:
mkdir -p /var/run/wpa_supplicant
① OPEN
wpa_supplicant -B -c/etc/plaintext.conf -iwlan0
wpa_cli -iwlan0 status // 查看状态
ifconfig wlan0 172.168.1.55 /* 无线网卡的IP */
ping 172.168.1.1 /* 无线网卡的网关 */
配置文件内容为:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="Linux"
key_mgmt=NONE
}
② WEP/WEP
wpa_supplicant -B -c/etc/wep.conf -iwlan0
wpa_cli -iwlan0 status // 查看状态
ifconfig wlan0 192.168.1.55
ping 192.168.1.1
配置文件:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="Linux"
key_mgmt=NONE
wep_key0="Linux"
wep_tx_keyidx=0
}
③WPA(TKIP)
wpa_supplicant -B -c/etc/wpa-psk-tkip.conf -iwlan0
wpa_cli -iwlan0 status // 查看状态
ifconfig wlan0 192.168.1.55
ping 192.168.1.1
配置文件
ctrl_interface=/var/run/wpa_supplicant # 一个目录,用于wpa_supplicant和wpa_cli的socket通信
network={
ssid="Linux"
proto=WPA # proto: list of accepted protocols, 可取WPA,RSN
# If not set, this defaults to: WPA RSN
key_mgmt=WPA-PSK # 认证方式
# If not set, this defaults to: WPA-PSK WPA-EAP
pairwise=TKIP # If not set, this defaults to: CCMP TKIP
group=TKIP # If not set, this defaults to: CCMP TKIP WEP104 WEP40
psk="Linux" /* 密码 */
}
④ WPA2(AES)
wpa_supplicant -B -c/etc/wpa_wpa2.conf -iwlan0
wpa_cli -iwlan0 status // 查看状态
ifconfig wlan0 192.168.1.55
ping 192.168.1.1
配置文件:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="Linux"
psk="Linux"
}
另:
wpa_cli可工作于"命令模式"和"交互模式"
⑤ 配置文件里设置多个network:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="Linux"
psk="baiwenwang123"
}
network={
ssid="Linux1"
psk="Linux"
}
⑥ 访问外网:
修改/etc/resolv.conf添加DNS:
nameserver 192.168.1.1
设置网关:
route add default gw 192.168.1.1
相关文章推荐
- UVA 11136 Hoax or what set
- Flask-SQLAlchemy获取一个字段里去掉重复的数据
- 17、登录案例
- POJ3487 The Stable Marriage Problem
- Linux-SHELL中sh和bash的区别
- 【转】理解cookie和session机制
- B - 敌兵布阵 线段树的点
- eMule 协议中的一些基本概念
- 第 12 章 CSS 入门
- Android 事件处理机制
- oracle 配置EM
- 公元2016年4月28日
- VIM配置文件
- 守护进程
- XGBoost模型
- 4.28总结
- PySide学习笔记第三章-利用信号槽机制关闭窗口
- 团队开发个人总结10
- [团队项目2.0]软件改进分析MathAPP
- 网络流模板(模板题:POJ1273)