Introduction and use of Wpa_supplican

Source: Internet
Author: User

first, what is Wpa_supplicant?
At present, more and more equipment carriers start with wireless function, and the configuration of wireless network can now use Wireless-tools or wpa_supplicant.
The difference is as follows:
1, Wpa_supplicant does not support all drivers, currently can only be connected to the already configured good Essid.
2, Wireless-tools almost support all drivers, but can not connect to those who only support the WPA AP.
At present, some chip manufacturers will customize their own WiFi protocol processing module, wireless network configuration will generally be based on wireless-tools development
Some private iwpriv commands interact with my AP.

Wpa_supplicant is similar to middleware, responsible for the user layer and WiFi low-level drive interactive information relay. At the same time, wpa_supplicant also resolves the WiFi interaction protocol and authentication of AP connections as an authentication server.

Second, Wpa_supplicant & WPA_CLI wireless network configuration
For wpa_supplicant source code, two executable files are generated after compilation: Wpa_supplicant and Wpa_cli.
1, Wpa_supplicant is the core program, as a service-side running in the background.
2, wpa_cli similar to a client, through the socket communication mode and wpa_supplicant interaction to achieve the attachment network search, settings and connections.

The procedure for connecting AP signals via Wpa_supplicant is as follows:
1, first wpa_supplicant as a service side first run up. Run the following command to start the service:
Wpa_supplicant-iwlan0-dwext-c/xx/wpa_xx.conf-dd-b
Commands commonly used parameters are described as follows:
-I: Network interface name
-C: Configuration file name
-C: Control Interface Name
-D: Driver type name
-P: Drive parameters
-B: Bridge Interface Name
-B: Background run
-D: Increase debugging information

2, Wpa_supplicant run up after will be through the WPA_CLI to interact with the set of WiFi.
For WPA_CLI operations, you can enter a command-line operation or direct a complete command setting.
If you do not enter the command line, you can do so by using a command similar to the following:
Wpa_cli-iwlan0-p/var/run/wpa_supplicant Add_network

Because Wpa_cli and wpa_supplicant interactions are through sockets,-p/var/run/wpa_supplicant is a socket channel.

If it is directly into the command line operation interface as follows:

WPA_CLI supported Operations Command everyone to run directly to the command view OK.

The command to connect AP via WPA_CLI is as follows:
1, connect the unencrypted AP

Add_network
1
Set_network 1 SSID "Test_wifi"
Ok
Set_network 1 Key_mgmt NONE
Ok
Enable_network 1
Ok

The 1 returned when the Add_network is executed indicates the network ID, typically starting at 0, and starting at 1 if 0 is already occupied, the default is cumulative.

2, connect the WPA-PSK/WPA2-PSK encrypted AP

Add_network
2
Set_network 2 SSID "Test_wifi"
Ok
Set_network 2 PSK "12345678"
Ok
Enable_network 2
Ok

3, connect the WEP encrypted AP

Add_network
3
Set_network 3 SSID "Test_wifi"
Ok
Set_network 3 Key_mgmt NONE
Ok
Set_network 3 Wep_key0 "12345"
Ok
Enable_network 3

We can not only connect AP through WPA_CLI, but also can do other things.

You can obtain all the AP information of the surrounding environment through WPA_CLI, including the SSID, encryption, signal strength, transmission speed, and other information. This information may be used in two development of some features.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.