linux连接wpa2,安装使用wpa_supplicant(ubuntu测试)

百度了以下相关资料,很是让人心寒,中国人都干嘛去了?都是解决wifi密码的文章,所以自行google了一下英文资料,整理下放到这里

安装openssl 必需

# sudo apt-get install openssl

# sudo apt-get install libssl-dev build-essential zlibc zlib-bin libidn11-dev libidn11

下载wpa_supplicant

这是主页,最新版本能在这里找到 :http://hostap.epitest.fi/wpa_supplicant/

自行新建并cd目录(以下是目前的最新版,随着时间的推移就不一定了)

# wget http://hostap.epitest.fi/releases/wpa_supplicant-2.0.tar.gz

# tar -xzvf  wpa_supplicant-2.0.tar.gz

# cd wpa_supplicant-2.0

# cd wpa_supplicant

# vi .config

把以下内容粘贴保存

#
 #.config
 #
 # Uncomment following two lines and fix the paths if you have installed openssl
 # in non-default location
 #CFLAGS += -I/usr/local/openssl/include
 #LIBS += -L/usr/local/openssl/lib
 # Driver interface for Host AP driver
 #CONFIG_DRIVER_HOSTAP=y
 # Driver interface for Agere driver
 #CONFIG_DRIVER_HERMES=y
 # Change include directories to match with the local setup
 #CFLAGS += -I../../hcf -I../../include -I../../include/hcf
 #CFLAGS += -I../../include/wireless
 # Driver interface for Prism54 driver
 # (Note: Prism54 is not yet supported, i.e., this will not work as-is and is
 # for developers only)
 #CONFIG_DRIVER_PRISM54=y
 # Driver interface for ndiswrapper
 #CONFIG_DRIVER_NDISWRAPPER=y
 # Driver interface for Atmel driver
 #CONFIG_DRIVER_ATMEL=y
 # Driver interface for Broadcom driver
 #CONFIG_DRIVER_BROADCOM=y
 # Example path for wlioctl.h; change to match your configuration
 #CFLAGS += -I/opt/WRT54GS/release/src/include
 # Driver interface for Intel ipw2100/2200 driver
 #CONFIG_DRIVER_IPW=y
 CONFIG_DRIVER_MADWIFI=y
 # Change include directories to match with the local setup
 CFLAGS += -I../madwif
 CONFIG_DRIVER_WEXT=y
 # Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
 #CONFIG_DRIVER_BSD=y
 #CFLAGS += -I/usr/local/include
 #LIBS += -L/usr/local/lib
 # Driver interface for Windows NDIS
 #CONFIG_DRIVER_NDIS=y
 #CFLAGS += -I/usr/include/w32api/ddk
 #LIBS += -L/usr/local/lib
 # For native build using mingw
 #CONFIG_NATIVE_WINDOWS=y
 # Additional directories for cross-compilation on Linux host for mingw target
 #CFLAGS += -I/opt/mingw/mingw32/include/ddk
 #LIBS += -L/opt/mingw/mingw32/lib
 #CC=mingw32-gcc
 # Driver interface for development testing
 #CONFIG_DRIVER_TEST=y
 # Driver interface for wired Ethernet drivers
 #CONFIG_DRIVER_WIRED=y
 CONFIG_IEEE8021X_EAPOL=y
 # EAP-MD5 (automatically included if EAP-TTLS is enabled)
 CONFIG_EAP_MD5=y
 # EAP-MSCHAPv2 (automatically included if EAP-PEAP is enabled)
 CONFIG_EAP_MSCHAPV2=y
 # EAP-TLS
 CONFIG_EAP_TLS=y
 # EAL-PEAP
 CONFIG_EAP_PEAP=y
 # EAP-TTLS
 CONFIG_EAP_TTLS=y
 # EAP-GTC
 CONFIG_EAP_GTC=y 
 # EAP-OTP
 CONFIG_EAP_OTP=y
 # LEAP
 CONFIG_EAP_LEAP=y
 # PKCS#12 (PFX) support (used to read private key and certificate file from
 # a file that usually has extension .p12 or .pfx)
 CONFIG_PKCS12=y
 # Include control interface for external programs, e.g, wpa_cli
 CONFIG_CTRL_IFACE=y

粘贴到此结束

安装
# make && make install


通过以下命令连接
# wpa_passphrase <yourAPssid> <yourpassphrase>

conf文件:

For WPA-PSK

  
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
# ap_scan=2 was the one for me you may try 0 or 1 indstead of 2
ap_scan=2
fast_reauth=1

network={
        ssid="my_network"
        proto=WPA
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP
        psk="secret_password"
}

For WPA2-Personal

  
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1

network={
        ssid="my_network"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP TKIP
        group=CCMP TKIP
        psk="secret_password"
}

Starting wpa_supplicant

6 条评论

What is 11 + 9 ?
Please leave these two fields as-is:
不答对这道小题,是不给通过的哦

昵称

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  1. null

    您好,我有个wpa_supplicant的问题想请教你,能不能留个邮箱交流一下?

  2. RRRRAA

    看到有人说等于没写,忍不住了,我就是看着作者的文章装好的wpa_supplicant,确实如作者所说资料很少
    再次感谢一下作者的热心分享

    1. admin

      感谢你的支持,我发的文章给大家带来了便利,我很开心

  3. RRRRAA

    e

  4. xxx

    个人感觉,你这篇文章等于没写。还说别人让你心寒, 你牛逼

    1. admin

      就不敢留个邮箱交流下?我寒的是baidu下搜索及资料的非常不全面,非常倾向于生活及广告等,所说wifi问题,是指中国人都在想着破解wifi密码,而对于问题的研究少些,等于没写?命令都贴上了,而且我也测试通过的,Ubuntu cubieboard arm下linux。