How to use wpa_cli command

Posted In Network - By Tum. On Saturday, February 28th, 2009 With 0 Comments

wpa_cli command เป็น command ที่มีอยู่ใน wpa_supplicant package ซึ่ง command นี้จะสามารถตรวจสอบสถานะการทำงาน, การแก้ไขค่า configurationต่างๆไม่ว่าจะเป็น trigger events หรือการใส่ค่าของ passphase เมื่อเวลา connect wireless

การใช้งาน wpa_cli command

ในการทำงานของ wpa_cli นี้จะสามารถทำงานได้ 2 mode การทำงานคือ command line interpreter เช่น wpa_cli -i eth1 scan หรือ interactive shell เช่น wpa_cli -i eth1 ในการใช้งานเราสามารถพิมพ์ command แบบย่อได้อย่างเช่น ต้องการตรวจสอบสถานะก็สามารถพิมพ์ได้ว่า wpa_cli -i eth1 stat แทนการพิมพ์ wpa_cli -i eth1 status ซึ่งรายละเอียดของคำสั่งแบบย่อนี้สามารถดูได้จากตารางด้านล่างนี้

Full command Short command Description
status stat displays the current connection status
disconnect disc prevents wpa_supplicant from connecting to any access point
quit q exits wpa_cli
terminate term kills wpa_supplicant
reconfigure recon reloads wpa_supplicant with the configuration file supplied (-c parameter)
scan scan scans for available access points (only scans it, doesn’t display anything)
scan_display scan_d displays the results of the last scan
list_networks list_n displays a list of configured networks and their status (active or not, enabled or disabled)
select_network select_n select a network among those defined to initiate a connection (ie select_network 0)
enable_network enable_n makes a configured network available for selection (ie enable_network 0)
disable_network disable_n makes a configured network unavailable for selection (ie disable_network 0)
remove_network remove_n removes a network and its configuration from the list (ie remove_network 0)
add_network add_n adds a new network to the list. Its id will be created automatically
set_network set_n shows a very short list of available options to configure a network when supplied with no parameters.See next section for a list of extremely useful parameters to be used with set_network and get_network.
get_network get_n displays the required parameter for the specified network. See next section for a list of parameters
save_config save_c saves the configuration

การใช้คำสั่ง wpa_cli ด้วย command set_networkสามารถใช้งา่นดังตัวอย่างด้านล่าง

[/crayon]

การใช้คำสั่ง wpa_cli ด้วย command get_networkสามารถใช้งา่นดังตัวอย่างด้านล่าง

[/crayon]

ในส่วนของพารามิเตอร์ key ของทั้ง set_network และ get_network สามารถดูรายละเอียดได้ดังตารางด้านล่าง

Key Description Parameters
ssid Access point name string
id_str String identifying the network string
priority Connection priority over other APs number (0 being the default low priority)
bssid Mac address of the access point mac address
scan_ssid Enable/disbale ssid scan 0, 1, 2
key_mgmt Type of key management WPA-PSK, WPA_EAP, None
pairwise Pairwise ciphers for WPA CCMP, TKIP
group=TKIP Group ciphers for WPA CCMP, TKIP, WEP104, WEP40
psk Pre-Shared Key (clear or encrypted) string
wep_key0 WEP key (up to 4: wep_key[0123]) string
eap Extensible Authentication Protocol MD5, MSCHAPV2, OTP, GTC, TLS, PEAP, TTLS
identity EAP identity string string
password EAP password string
ca_cert Pathname to CA certificate file /full/path/to/certificate
client_cert Pathname to client certificate /full/path/to/certificate (PEM/DER)
private_key Pathname to a client private key file /full/path/to/private_key (PEM/DER/PFX)

ตัวอย่างการใช้งาน set_network ด้วยวิธี command line:

[/crayon]

ตัวอย่างการ setting set_network keys ในไฟล์ wpa_supplicant.conf:

[/crayon]

ขอขอบคุณข้อมูลจากทาง Red Hat ครับ

คำค้นยอดนิยม: wpa_cli, wpa_cli commands, wpa_cli howto, wpa_cli command, how to use wpa_cli
Tags:

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

*