How can I make hostapd WPA2 work?

I'm trying to create a simple WPA2 WiFi access point so that I can use WiFi more reliably when I'm far away from the router.

I'm following this guide except I'm using a custom version of hostapd that has the driver for my USB WiFi dongle.

I modify the hostapd.conf configuration slightly from the guide to create an open hotspot:

interface=wlan0 ssid=WiFi channel=6 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 driver=rtl871xdrv ieee80211n=1 hw_mode=g device_name=RTL8192CU manufacturer=Realtek 

When I do this, everything works like a charm and I can browse the Internet when connected to the AP from my phone.

But, of course, an open AP is not desirable and I wish to create a WPA2 AP so I modify the configuration file:

interface=wlan0 ssid=WiFi channel=6 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=Raspberry5 wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP driver=rtl871xdrv ieee80211n=1 hw_mode=g device_name=RTL8192CU manufacturer=Realtek 

This does not work like a charm! Despite entering the correct password, "Raspberry5" when connecting to the AP, my phone (running Android Marshmallow) hangs on "Connecting..." for a while before returning to "Saved..." and then returning to "Connecting..." This occurs endlessly, with "Authentication problem" occasionally flashing up.

How can I resolve this problem so that I am able to connect to the AP successfully?

Here's the output of hostapd -d /etc/hostapd/hostapd.conf:

random: Trying to read entropy from /dev/random Configuration file: /etc/hostapd/hostapd.conf drv->ifindex=3 l2_sock_recv==l2_sock_xmit=0x0xb69648 BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits) Completing interface initialization Mode: IEEE 802.11g  Channel: 6  Frequency: 2437 MHz 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 +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2 rtl871x_set_key_ops rtl871x_set_key_ops rtl871x_set_key_ops rtl871x_set_key_ops Using interface wlan0 with hwaddr 80:1f:02:d0:f5:94 and ssid 'WiFi' Deriving WPA PSK based on passphrase SSID - hexdump_ascii(len=4):      57 69 46 69                                       WiFi PSK (ASCII passphrase) - hexdump_ascii(len=10): [REMOVED] PSK (from passphrase) - hexdump(len=32): [REMOVED] rtl871x_set_wps_assoc_resp_ie rtl871x_set_wps_beacon_ie rtl871x_set_wps_probe_resp_ie urandom: Got 20/20 bytes from /dev/urandom GMK - hexdump(len=32): [REMOVED] Key Counter - hexdump(len=32): [REMOVED] WPA: group state machine entering state GTK_INIT (VLAN-ID 0) GTK - hexdump(len=16): [REMOVED] WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0) rtl871x_set_key_ops rtl871x_set_beacon_ops rtl871x_set_hidden_ssid ignore_broadcast_ssid:0, WiFi,4 rtl871x_set_acl wlan0: Setup of interface done. 

Here's /etc/network/interfaces:

# interfaces(5) file used by ifup(8) and ifdown(8)  # Please note that this file is written to be used with dhcpcd # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'  # Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d  auto lo iface lo inet loopback  iface eth0 inet dhcp  allow-hotplug wlan0 iface wlan0 inet static   address   netmask  up iptables-restore < /etc/iptables.ipv4.nat 

And here's /etc/dhcp/dhcpd.conf without comments:

ddns-update-style none; default-lease-time 600; max-lease-time 7200; authoritative; log-facility local7; subnet netmask {         range;         option broadcast-address;         option routers;         default-lease-time 600;         max-lease-time 7200;         option domain-name "local";         option domain-name-servers,; } 

I've modified both /etc/network/interfaces and /etc/dhcp/dhcp.conf from the guide to use the IP address range that I wish to use.

Thanks in advance for any help!


Category: networking Time: 2016-07-28 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.220 (s). 12 q(s)