WiFi test Correlation (IWCONFIG,WPA supplicant usage)

Source: Internet
Author: User

Iwconfig usage

1. Turn on the wireless card power

Iwconfig Wlan0 Txpower No

2. List the wireless networks in the area

Iwconfig wlan0 Scan

3. Assuming that you want to connect to a network myhome (that is, Essid is a myhome network), then enter the command

Iwconfig wlan0 Essid "MyHome"

If the network is encrypted and the password is 0123456789, enter the command

Iwconfig wlan0 Essid "MyHome" key 0123-4567-89

4 if normal, enter

Iwconfig Wlan0

You can see the parameters that are properly connected.

5. Start the wireless card

Ifconfig wlan0 up

6. If you are using DHCP to obtain IP, then use dhclient or DHCPCD to obtain the IP

Dhclient Wlan0 or DHCPCD wlan0

7. Now the wireless card should be able to use the normal.

WPA supplicant

The WPA supplicant Toolkit allows you to connect to those APs that use WPA. Because it's just a beta version, the way it's configured is still constantly changing-even though it's already working well in most cases.

Code Listing 2.1: Installing Wpa_supplicant

Emerge Net-wireless/wpa_supplicant

Important: to make wpa_supplicant work properly, you must open Config_packet support in the kernel .

Now we need to configure the /etc/conf.d/net file so that we can choose to use wpa_supplicant instead of Wireless-tools (both are installed in the system, the default is to use Wireless-tools).

Code Listing 2.2: Configuring Wpa_supplicant in/etc/conf.d/net

# use Wpa_supplicant instead of wireless-toolsmodules= ("Wpa_supplicant")# because Wpa_supplicant doesn't have a good auto-detect driver, so we need to specify the driver we're using. wpa_supplicant_eth0= "-dmadwifi"

Note: If you are using the Host-ap driver, you first set the wireless device card to managed mode so that you can work properly with wpa_supplicant. You can do this by setting iwconfig_eth0= "mode managed" in/etc/conf.d/net.

It looks simple, doesn't it? However, we also need to configure the wpa_supplicant itself, which will be more cumbersome, depending on the level of security of the AP you are connecting to. The following example is extracted from the /usr/share/doc/wpa_supplicant-<version>/wpa_supplicant.conf.gz and simplified, and this file is derived from the Wpa_ supplicant package.

Code Listing 2.3: an example of a/etc/wpa_supplicant/wpa_supplicant.conf

[CPP]View Plaincopy
  1. # Please do not modify the following line of content, otherwise it will not work properly
  2. Ctrl_interface=/var/run/wpa_supplicant
  3. # Ensure that only the root user can read the configuration of WPA
  4. Ctrl_interface_group=0
  5. # Use Wpa_supplicant to scan and select APS
  6. Ap_scan=1
  7. # simple case: Wpa-psk Password authentication method, PSK is an ASCII passphrase, all legitimate encryption methods allow connection
  8. network={
  9. ssid="Simple"
  10. Psk="very secret passphrase"
  11. # The higher the priority, the sooner it can be matched.
  12. Priority=5
  13. }
  14. # Same as previous settings, but requires scan of specific SSID (for APS that refuse to broadcast SSID)
  15. network={
  16. Ssid="Second SSID"
  17. Scan_ssid=1
  18. Psk="very secret passphrase"
  19. priority=2
  20. }
  21. # Use only WPA-PSK mode. Allows any combination of legitimate encryption methods to be used
  22. network={
  23. Ssid="Example"
  24. Proto=wpa
  25. Key_mgmt=wpa-psk
  26. PAIRWISE=CCMP TKIP
  27. group=ccmp TKIP WEP104 WEP40
  28. Psk=06b4be19da289f475aa46a33cb793029d4ab3db7a23ee92382eb0106c72ac7bb
  29. priority=2
  30. }
  31. # Clear Text connection (not using WPA and IEEE802.1X)
  32. network={
  33. ssid="Plaintext-test"
  34. Key_mgmt=none
  35. }
  36. # shared WEP key connection mode (without WPA and IEEE802.1X)
  37. network={
  38. ssid="Static-wep-test"
  39. Key_mgmt=none
  40. # quotes contain keys that are ASCII keys
  41. wep_key0="ABCDE"
  42. # no quotes contain keys that are hexadecimal keys
  43. wep_key1=0102030405
  44. wep_key2="1234567890123"
  45. Wep_tx_keyidx=0
  46. Priority=5
  47. }
  48. # shared WEP key connection mode (no WPA and ieee802.1x), using shared Key IEEE802.11 authentication method
  49. network={
  50. ssid="Static-wep-test2"
  51. Key_mgmt=none
  52. wep_key0="ABCDE"
  53. wep_key1=0102030405
  54. wep_key2="1234567890123"
  55. Wep_tx_keyidx=0
  56. Priority=5
  57. Auth_alg=shared
  58. }
  59. # using WPA-NONE/TKIP in the Ibss/ad-hoc network
  60. network={
  61. ssid="Test Adhoc"
  62. Mode=1
  63. Proto=wpa
  64. Key_mgmt=wpa-none
  65. Pairwise=none
  66. Group=tkip
  67. psk="Secret passphrase"
  68. }

WiFi graphics configuration software can be used:http://wifi-radar.berlios.de/

WiFi More detailed introduction can be consulted:http://www.gentoo.org/doc/zh_cn/handbook/handbook-x86.xml?part=4&chap=4

WiFi test Correlation (IWCONFIG,WPA supplicant usage)

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.