2017-03-01 82 views
0

我有一個樹莓派PI 2,並配置了HOSTAPD和udhcpd作爲熱點。 我面臨的第一個問題是司機。我購買的WiFi適配器是Realtek芯片組。現在通過關注這篇文章解決了這個問題。 https://www.raspberrypi.org/forums/view ... hp?t = 62371無法使用HostAPD進行身份驗證

現在我面對的第二個問題是WPA2身份驗證。如果我設置hostapd打開\沒有身份驗證它就像一個魅力。如果我設置了身份驗證,我無法連接。 Andriod設備圍繞連接環繞,iPhone返回密碼不正確 - 甚至認爲我正在輸入正確的密碼。

下面是hostapd.conf的配置,並從hostapd登錄--ddK /etc/hostapd/hostapd.conf

interface=wlan0 
#driver= 
ssid=<removed> 
hw_mode=g 
channel=1 
macaddr_acl=0 
auth_algs=1 
ignore_broadcast_ssid=0 
wpa=2 
wpa_passphrase=<removed> 
wpa_key_mgmt=WPA-PSK 
wpa_pairwise=TKIP 
rsn_pairwise=CCMP 

#log 
logger_syslog=-1 
logger_syslog_level=2 
logger_stdout=-1 
logger_stdout_level=2 


[email protected] ~ $ sudo hostapd -ddK /etc/hostapd/hostapd.conf 
random: Trying to read entropy from /dev/random 
Configuration file: /etc/hostapd/hostapd.conf 
nl80211: interface wlan0 in phy phy0 
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0 
nl80211: Using driver-based off-channel TX 
nl80211: Add own interface ifindex 3 
nl80211: Set mode ifindex 3 iftype 3 (AP) 
nl80211: Create interface iftype 6 (MONITOR) 
nl80211: New interface mon.wlan0 created: ifindex=6 
nl80211: Add own interface ifindex 6 
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits) 
nl80211: Regulatory information - country=00 
nl80211: 2402-2472 @ 40 MHz 
nl80211: 2457-2482 @ 20 MHz 
nl80211: 2474-2494 @ 20 MHz 
nl80211: 5170-5250 @ 80 MHz 
nl80211: 5250-5330 @ 80 MHz 
nl80211: 5490-5730 @ 160 MHz 
nl80211: 5735-5835 @ 80 MHz 
nl80211: 57240-63720 @ 2160 MHz 
nl80211: Added 802.11b mode based on 802.11g information 
Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=20 dBm 
Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=20 dBm 
Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=20 dBm 
Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=20 dBm 
Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=20 dBm 
Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=20 dBm 
Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=20 dBm 
Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=20 dBm 
Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=20 dBm 
Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=20 dBm 
Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=20 dBm 
Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=20 dBm 
Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=20 dBm 
Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=20 dBm 
Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=20 dBm 
Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=20 dBm 
Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=20 dBm 
Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=20 dBm 
Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=20 dBm 
Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=20 dBm 
Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=20 dBm 
Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=20 dBm 
Completing interface initialization 
Mode: IEEE 802.11g Channel: 1 Frequency: 2412 MHz 
nl80211: Set freq 2412 (ht_enabled=0 sec_channel_offset=0) 
RATE[0] rate=10 flags=0x1 
RATE[1] rate=20 flags=0x1 
RATE[2] rate=55 flags=0x1 
RATE[3] rate=110 flags=0x1 
RATE[4] rate=60 flags=0x0 
RATE[5] rate=90 flags=0x0 
RATE[6] rate=120 flags=0x0 
RATE[7] rate=180 flags=0x0 
RATE[8] rate=240 flags=0x0 
RATE[9] rate=360 flags=0x0 
RATE[10] rate=480 flags=0x0 
RATE[11] rate=540 flags=0x0 
Flushing old station entries 
Deauthenticate all stations 
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0 
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0 
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0 
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0 
Using interface wlan0 with hwaddr 40:a5:ef:07:b4:0e and ssid 'kid' 
Deriving WPA PSK based on passphrase 
SSID - hexdump_ascii(len=3): 
    6b 69 64           <removed>    
PSK (ASCII passphrase) - hexdump_ascii(len=8): 
    4b 69 64 31 32 33 34 35       <removed>  
PSK (from passphrase) - hexdump(len=32): eb f3 9f 60 48 03 d8 c2 6d 29 b5 34 1f 22 fe cd 02 ff 43 6e 7e 35 88 d9 41 49 42 27 26 c5 08 ad 
random: Got 16/20 bytes from /dev/random 
random: Only 16/20 bytes of strong random data available from /dev/random 
random: Not enough entropy pool available for secure operations 
WPA: Not enough entropy in random pool for secure operations - update keys later when the first station connects 
Get randomness: len=32 entropy=0 
GMK - hexdump(len=32): 8b 1b 05 6b 6c a3 27 3b 7d 4c 8d 08 75 c0 94 2e e9 ad cd 06 90 6b c3 8f 10 74 96 6e 07 a7 44 b7 
Get randomness: len=32 entropy=0 
Key Counter - hexdump(len=32): 8d 5d 7d 92 d4 6c 8b 56 cd f2 10 a6 4a ba 4f c9 96 1d 93 28 db d2 3b 1d e2 a2 74 02 c8 41 cf 26 
WPA: Delay group state machine start until Beacon frames have been configured 
VLAN: vlan_set_name_type(name_type=2) 
nl80211: Set beacon (beacon_set=0) 
WPA: Start group state machine to set initial keys 
WPA: group state machine entering state GTK_INIT (VLAN-ID 0) 
Get randomness: len=16 entropy=0 
GTK - hexdump(len=16): ba 94 df 43 2f 11 50 e1 86 45 25 87 fb 9a f3 b8 
WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0) 
wpa_driver_nl80211_set_key: ifindex=3 alg=3 addr=0x890c8 key_idx=1 set_tx=1 seq_len=0 key_len=16 
    broadcast key 
wpa_driver_nl80211_set_operstate: operstate 0->1 (UP) 
netlink: Operstate: linkmode=-1, operstate=6 
Failed to set TX queue parameters for queue 0. 
Failed to set TX queue parameters for queue 1. 
Failed to set TX queue parameters for queue 2. 
Failed to set TX queue parameters for queue 3. 
wlan0: Setup of interface done. 
random: Got 4/4 bytes from /dev/random 
RTM_NEWLINK: operstate=1 ifi_flags=0x1002() 
nl80211: Ignore interface down event since interface wlan0 is up 
RTM_NEWLINK: operstate=1 ifi_flags=0x1002() 
nl80211: Ignore interface down event since interface mon.wlan0 is up 
RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP]) 
RTM_NEWLINK, IFLA_IFNAME: Interface 'mon.wlan0' added 
Unknown event 5 
RTM_NEWLINK: operstate=1 ifi_flags=0x1003 ([UP]) 
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added 
nl80211: if_removed already cleared - ignore event 
RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP]) 
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added 
nl80211: if_removed already cleared - ignore event 
VLAN: vlan_newlink(wlan0) 
nl80211: Event message available 
nl80211: New station <iphone MAC address> 
nl80211: Event message available 
nl80211: Delete station <iphone MAC address> 
wlan0: WPA rekeying GTK 
WPA: group state machine entering state SETKEYS (VLAN-ID 0) 
Get randomness: len=16 entropy=0 
GTK - hexdump(len=16): 06 b2 b8 05 a7 b6 a6 03 81 1b a4 9a 01 bb 8c 29 
wpa_group_setkeys: GKeyDoneStations=0 
WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0) 
wpa_driver_nl80211_set_key: ifindex=3 alg=3 addr=0x890c8 key_idx=2 set_tx=1 seq_len=0 key_len=16 
    broadcast key 
^CSignal 2 received - terminating 
Flushing old station entries 
Deauthenticate all stations 
nl80211: Remove interface ifindex=6 
netlink: Operstate: linkmode=0, operstate=6 
nl80211: Set mode ifindex 3 iftype 2 (STATION) 

我試圖卸載並重新安裝hostapd

回答

0

我沒看到提到的DHCP服務器 - 這是用hostapd建立無線網絡的關鍵基礎設施。關於設置DHCP服務器的換行符下面提供了更多信息。然而,在介紹之前,這裏有一些鏈接,提供更多一般信息。所有鏈接都是charlesreid1.com/wiki。我用它們記錄了我將Raspberry Pi設置爲無線接入點的過程。所有頁面都是指用樹莓派創建一個WiFi網絡/接入點:

下面是具體設置DHCP服務器的一些信息,以防將Raspberry Pi設置爲無線AP。


通過編輯/etc/dhcp/dhcp.conf來設置DHCP服務器。

首先,添加「authoritative」這個詞,表示這是網絡上的權威DHCP。 (你應該看到一些評論和線被安裝到樹莓派默認情況下,DHCP的配置文件已經填寫):

# If this DHCP server is the official DHCP server for the local 
    # network, the authoritative directive should be uncommented. 
    authoritative; 

取消註釋權威。

然後在DHCP配置文件中添加一個塊來設置IP地址分配/配置。我在家庭網絡上使用IP子網192.168.42.X。

subnet 192.168.42.0 netmask 255.255.255.0 { 
    range 192.168.42.10 192.168.42.50; 
    option broadcast-address 192.168.42.255; 
    option routers 192.168.42.1; 
    default-lease-time 600; 
    max-lease-time 7200; 
    option domain-name "local"; 
    option domain-name-servers 8.8.8.8, 8.8.4.4; 
    } 

你不需要所有這些選項,但試試看。

下一步,你需要告訴要使用的接口DHCP服務器,以便您可以編輯/etc/default/isc-dhcp-server和更新INTERFACES部分以指向特定的接口:

INTERFACES="wlan0" 

現在,你需要更新你的網絡接口,所以它知道不要嘗試尋找一個IP地址。把接口關閉,

$ sudo ifdown wlan0 

然後編輯/etc/network/interfaces和手動指定爲網關地址(再次聲明,我使用192.168.42.X模式郫縣的IP地址,但你可以使用任何你喜歡的話,只要上面提到的DHCP配置文件)匹配:

allow-hotplug wlan0 

iface wlan0 inet static 
    address 192.168.42.1 
    netmask 255.255.255.0 

然後最後一步是編輯hostapd.conf文件,而您也已經完成。這裏是什麼樣子啓用WPA2(看起來像你已經有了這部分想通了,和工作雖然):

interface=wlan0 
driver=<insert driver here> 
ssid=<insert SSID here> 
hw_mode=g 
channel=6 
macaddr_acl=0 
auth_algs=1 
ignore_broadcast_ssid=0 
wpa=2 
wpa_passphrase=<insert passphrase here> 
wpa_key_mgmt=WPA-PSK 
wpa_pairwise=TKIP 
rsn_pairwise=CCMP 

希望一些這方面的信息可以使用的...快樂的黑客攻擊!