2

In order to create an AP on my Pi I followed this tutorial at adafruit, which seems to be very similar to many others on the web: https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/install-software.

I've just replaced "eth0" for "wlan1" as I'm using wireless connection and would like to replace it further by "ppp0" to establish 3G-WIFI connection. As you can expect when I get through the tutorial, it doesn't work :-) It seems HostAPD is configured for its visible in wifi networks list, but it isn't possible to connect to it. Perhaps something wrong with DHCP or bridge forwarding? The Terminal has been ioctl[RTL_IOCTL_HOSTAPD]: Invalid argument which has been fixed by downloading driver from Realtek's website but althought the AP is visible, it is still unable to connect to is as Terminal output of HostAPD is:

sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
drv->ifindex=3
l2_sock_recv==l2_sock_xmit=0x0x50c638
+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 74:da:38:5b:4f:f4 and ssid 'PiNet'
rtl871x_set_wps_assoc_resp_ie
rtl871x_set_wps_beacon_ie
rtl871x_set_wps_probe_resp_ie
rtl871x_set_key_ops
rtl871x_set_beacon_ops
rtl871x_set_hidden_ssid ignore_broadcast_ssid:0, PiNet,5
rtl871x_set_acl
+rtl871x_get_sta_wpaie, 18:34:51:53:60:85 is sta's address
wlan0: STA 18:34:51:53:60:85 IEEE 802.11: associated
rtl871x_set_key_ops
rtl871x_set_key_ops
rtl871x_set_key_ops
+rtl871x_send_eapol
+rtl871x_send_eapol
rtl871x_set_key_ops
wlan0: AP-STA-CONNECTED 18:34:51:53:60:85
wlan0: STA 18:34:51:53:60:85 RADIUS: starting accounting session 56E50D15-00000000
wlan0: STA 18:34:51:53:60:85 WPA: pairwise key handshake completed (RSN)
wlan0: STA 18:34:51:53:60:85 WPA: received EAPOL-Key 2/4 Pairwise with unexpected replay counter
wlan0: STA 18:34:51:53:60:85 WPA: received EAPOL-Key 4/4 Pairwise with unexpected replay counter
wlan0: STA 18:34:51:53:60:85 IEEE 802.11: disassociated
wlan0: AP-STA-DISCONNECTED 18:34:51:53:60:85
rtl871x_set_key_ops
rtl871x_set_key_ops
+rtl871x_sta_remove_ops, 18:34:51:53:60:85 is sta address removed

It seems that's something wrong with DHCP:

systemctl status isc-dhcp-server.service
● isc-dhcp-server.service - LSB: DHCP server
   Loaded: loaded (/etc/init.d/isc-dhcp-server)
   Active: failed (Result: exit-code) since Sun 2016-03-13 08:48:26 UTC; 23s ago
  Process: 1465 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)

I followed the tutorial mentioned above and have no idea what could go wrong with setting up DHCP. My network interfaces file is below.

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
#iface wlan0 inet manual
#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

iface wlan0 inet static
        address 192.168.42.1
        netmask 255.255.255.0

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

#auto br0
#iface br0 inet dhcp
#bridge_ports wlan1 wlan0

up iptables-restore < /etc/iptables.ipv4.nat
5
  • The image is illegible. Paste text.
    – Milliways
    Commented Mar 12, 2016 at 21:58
  • The error from HostAPD stated: ioctl[RTL_IOCTL_HOSTAPD]: Invalid argument which has been fixed by downloading a driver from[link]realtek.com.tw/downloads/…. My current Terminal output is as follows: wlan0: STA 18:34:51:53:60:85 WPA: received EAPOL-Key 2/4 Pairwise with unexpected replay counter wlan0: STA 18:34:51:53:60:85 WPA: received EAPOL-Key 4/4 Pairwise with unexpected replay counter wlan0: STA 18:34:51:53:60:85 IEEE 802.11: disassociated wlan0: AP-STA-DISCONNECTED 18:34:51:53:60:85 Commented Mar 13, 2016 at 8:47
  • The AP is visible but it's still unable to connect to it. It might be due to DHCP as the Terminal output is as follows: pi@raspberrypi:~ $ systemctl status isc-dhcp-server.service ● isc-dhcp-server.service - LSB: DHCP server Loaded: loaded (/etc/init.d/isc-dhcp-server) Active: failed (Result: exit-code) since Sun 2016-03-13 08:48:26 UTC; 23s ago Process: 1465 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE) I followed the tutorial posted above and have no idea what could go wrong. Commented Mar 13, 2016 at 8:52
  • The question has been just edited :-) Commented Mar 13, 2016 at 9:07
  • I guess the rub is in bridging the connection but can't find what could be wrong. Anybody's idea? Commented Mar 14, 2016 at 12:56

2 Answers 2

1

1.Use the simplest hostapd.conf file available from here: https://wiki.gentoo.org/wiki/Hostapd

2.Check to make sure you dont have conflicting wifi credentials in wpa_supplicant file.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Comment out any lines showing another wifi network. Mine only has:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

update_config=1

country=US

  1. make sure wpa_supplicant not interfering:

    pkill wpa_supplicant

4.Reboot and start/restart rpi and hostapd service as you modify things.

3
  • 1
    With using wheezy the question hopeless outdated.
    – Ingo
    Commented Nov 11, 2020 at 9:40
  • Why is that @ingo?
    – MethodMan
    Commented Nov 12, 2020 at 23:45
  • 1
    Wheezy isn't supported since years. It doesn't get any updates and its repository isn't available at default location anymore. It is only archived for historical reasons.
    – Ingo
    Commented Nov 13, 2020 at 11:28
0

I just completed this task on my Raspberry pi 2 B model. As its fresh in my brain, thought to put more details in issue you are stuck with. (I had run into similar) . Pi2 B model don't have inbuild wifi. I have separate wifi adapter connected to USB (its cheap Tenda adaptor. Took days to get wpa_supplican't working for it due to absence of driver firmware issue ref: https://github.com/lwfinger/rtl8188eu/issues/3 ).

I find above given tutorial good and description but drawback is it has all images, no text

Use references after google search: Eg: https://seravo.fi/2014/create-wireless-access-point-hostapd

Would have been good if you could have provided details on 1. uname -a 2. lsusb 3. your config files. 4. logs. 5. detailed error (some details are present but more needed.)

My setup and specs:

raspberrypi:~# uname -a
Linux raspberrypi 4.4.34-v7+ #930 SMP Wed Nov 23 15:20:41 GMT 2016 armv7l GNU/Linux

raspberrypi:~# /etc/init.d/isc-dhcp-server status 
● isc-dhcp-server.service - LSB: DHCP server    
Loaded: loaded (/etc/init.d/isc-dhcp-server)    
Active: active (running) since Sat 2017-04-22 16:17:16 UTC; 1h 31min ago    CGroup: /system.slice/isc-dhcp-server.service
           └─1374 /usr/sbin/dhcpd -q -cf /etc/dhcp/dhcpd.conf -pf /var/run/dhcpd.pid wlan0

# one which worked for me (for kernel/OS version)
raspberrypi:~# hostapd -v 
hostapd v0.8.x_rtw_r7475.20130812_beta User space daemon for IEEE 802.11 AP management, IEEE
802.1X/WPA/WPA2/EAP/RADIUS Authenticator Copyright (c) 2002-2011, Jouni Malinen <[email protected]> and contributors

# this was installed when i did apt-get install hostapd. Latest but not compatible for OS/kernel
raspberrypi:~# /usr/sbin/hostapd.ko.org -v  
hostapd v2.3 User space daemon for IEEE 802.11 AP management, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator Copyright (c) 2002-2014, Jouni Malinen <[email protected]> and contributors

Here are some configs:
raspberrypi:~# /etc/init.d/dnsmasq status

● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled)
  Drop-In: /run/systemd/generator/dnsmasq.service.d
           └─50-dnsmasq-$named.conf, 50-insserv.conf-$named.conf
   Active: active (running) since Sat 2017-04-22 16:17:12 UTC; 1h 34min ago
 Main PID: 1164 (dnsmasq)
   CGroup: /system.slice/dnsmasq.service
           └─1164 /usr/sbin/dnsmasq -x /var/run/dnsmasq/dnsmasq.pid -u dnsmasq -r /var/run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service --trust-ancho...

DHCP logs:

Apr 22 16:17:12 raspberrypi dnsmasq-dhcp[1164]: DHCP, IP range 192.168.10.0 -- 192.168.10.100, lease time 12h
Apr 22 16:17:12 raspberrypi dnsmasq-dhcp[1164]: DHCP, sockets bound exclusively to interface wlan0
Apr 22 16:17:12 raspberrypi dnsmasq[1164]: reading /var/run/dnsmasq/resolv.conf
Apr 22 16:17:12 raspberrypi dnsmasq[1164]: using nameserver 192.168.0.1#53
Apr 22 16:17:12 raspberrypi dnsmasq[1164]: read /etc/hosts - 5 addresses
Apr 22 16:17:12 raspberrypi systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
Apr 22 17:01:48 raspberrypi dnsmasq-dhcp[1164]: DHCPDISCOVER(wlan0) <mac-id>
Apr 22 17:01:48 raspberrypi dnsmasq-dhcp[1164]: DHCPOFFER(wlan0) 192.168.10.10 <mac-id>
Apr 22 17:01:48 raspberrypi dnsmasq-dhcp[1164]: DHCPREQUEST(wlan0) 192.168.10.10 <mac-id>
Apr 22 17:01:48 raspberrypi dnsmasq-dhcp[1164]: DHCPACK(wlan0) 192.168.10.10 <mac-id> RedmiNote3-Redminote

raspberrypi:~# more /etc/hostapd/hostapd.conf | grep -v "^#" | grep -v "^$" | more

interface=wlan0
driver=rtl871xdrv
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
ctrl_interface=wlan0
ctrl_interface_group=0
ssid=raspberry
country_code=IN
hw_mode=g
channel=1
beacon_int=100
dtim_period=2
max_num_sta=255
rts_threshold=2347
fragm_threshold=2346
macaddr_acl=0
auth_algs=3
ignore_broadcast_ssid=0
wmm_enabled=1
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
wmm_ac_bk_aifs=7
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0
wmm_ac_be_aifs=3
wmm_ac_be_cwmin=4
wmm_ac_be_cwmax=10
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
wmm_ac_vi_aifs=2
wmm_ac_vi_cwmin=3
wmm_ac_vi_cwmax=4
wmm_ac_vi_txop_limit=94
wmm_ac_vi_acm=0
wmm_ac_vo_aifs=2
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_txop_limit=47
wmm_ac_vo_acm=0
eapol_key_index_workaround=0
eap_reauth_period=0
eap_server=0
own_ip_addr=127.0.0.1
wpa=3
wpa_passphrase=<passphrase>
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

raspberrypi:~# hostapd /etc/hostapd/hostapd.conf

Configuration file: /etc/hostapd/hostapd.conf
drv->ifindex=3
l2_sock_recv==l2_sock_xmit=0x0x63a638
rtl871x_set_rts_threshold, rts=2347
rtl871x_set_frag_threshold, frag=2346
+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 40:a5:ef:01:92:ba and ssid 'raspberry'
rtl871x_set_wps_assoc_resp_ie
rtl871x_set_wps_beacon_ie
rtl871x_set_wps_probe_resp_ie
rtl871x_set_key_ops
rtl871x_set_beacon_ops
rtl871x_set_hidden_ssid ignore_broadcast_ssid:0, raspberry,9
rtl871x_set_acl
+rtl871x_get_sta_wpaie, <MAC-ID> is sta's address
wlan0: STA <MAC-ID> IEEE 802.11: associated
rtl871x_set_key_ops
rtl871x_set_key_ops
rtl871x_set_key_ops
+rtl871x_send_eapol
+rtl871x_send_eapol
rtl871x_set_key_ops
wlan0: AP-STA-CONNECTED <MAC-ID>
wlan0: STA <MAC-ID> RADIUS: starting accounting session 58FB9E1D-00000000
wlan0: STA <MAC-ID> WPA: pairwise key handshake completed (RSN)

With above info, you may run through each step: ifup wlan0 ifconfig hostapd

For sure, DHCP server should be fixed and should be up as device connecting need to get IP else device gets disconnnected.

Also try with other light weight dhcp server to see if it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.