天天看點

wpa_cli和wpa_supplicant使用,配置無線AP名和密碼,靜态ip位址

配置靜态ip方法分享:

通過序列槽指令行輸入如下指令:     

1. 添加無線網絡接入點(AP) 及其 密碼:

# wpa_cli -p /data/misc/wpa_supplicant

wpa_cli v0.5.11

Copyright (c) 2004-2008, Jouni Malinen and contributors              

This program is free software. You can distribute it and/or modify it          

under the terms of the GNU General Public License version 2.                   

Alternatively, this software may be distributed under the terms of the         

BSD license. See README and COPYING for more details.                          

Selected interface 'eth0'                                                      

Interactive mode

> add_network

> set_network 0 ssid "camct_backup"

OK

> set_network 0 key_mgmt NONE

>                           

>

> set_network 0 wep_key0 12345678901234567890123456

> binder: release 1142:1142 transaction 2748 out, still active

select_network 0

<2>CTRL-EVENT-STATE-CHANGE id=-1 state=2

>status                                                                          

bssid=00:00:00:00:00:00                                                        

ssid=camct_backup                                                              

id=0                                                                           

pairwise_cipher=WEP-104                                                        

group_cipher=WEP-104                                                           

key_mgmt=NONE                                                                  

wpa_state=COMPLETED           

2. 配置ip位址:

#wpa_supplicant -Dwext -ieth0 -c /data/misc/wifi/wpa_supplicant.conf -B

指令解釋:

        參數-B代表背景運作,-ieth0代表使用裝置eth0,-Dwex代表網卡晶片是wex,-c指定配置檔案。

檢視配置

#wpa_cli -p /data/misc/wpa_supplicant

>status                                                                   bssid=00:00:00:00:00:00                                                         ssid=camct_backup                                                               id=0                                                                            pairwise_cipher=WEP-104                                                         group_cipher=WEP-104                                                           

key_mgmt=NONE   

wpa_state=COMPLETED 

配置ip:

#ifconfig eth0 192.168.177.33

之後再檢視配置會看到 ip_address=192.168.177.33