1

I configured my raspberrypi as a wifi repeater using hostapd and dnsmasq. I did not touch my /etc/network/interfaces, just added

interface wlan0
static ip_address=192.168.42.1/24

to /etc/dhcpcd.conf and

interface=wlan0
dhcp-range=192.168.42.20,192.168.42.100,255.255.255.0,12h

to /etc/dnsmasq.conf

I think I configured hostapd right (added DAEMON_CONF="/etc/hostapd/hostapd.conf" to /etc/default/hostapd etc.) and it works.

But after a reboot my interface (managed by hostapd) is down. When I restart hostapd, everything works fine again, so I added

sleep 1 && service hostapd restart

to my /etc/rc.local as a workaround.

What could be the reason?

Is there a better way to fix it?

3
  • 1
    Starting an emulated service (service hostapd restart) in an emulated service (/etc/rc.local) is very confusing. I don't know what systemd really do with this double emulated things that does not exactly match old style SysV behavior: Compatibility with SysV. Maybe you can get it to run, good luck ;-). I prefer to use systemd directly.
    – Ingo
    Commented Oct 13, 2018 at 8:54
  • @Ingo I can change that, but what I'm wondering about is why I have to restart hostapd.
    – jake
    Commented Oct 14, 2018 at 12:49
  • Because you missed the entry nohook wpa_supplicant in hostapd.conf ;-)
    – Ingo
    Commented Oct 14, 2018 at 14:32

1 Answer 1

2

Compared to the official guidelines you are missing

a) an entry to the file /etc/default/hostapd:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

b) an entry to the file dhcpcd.conf

nohook wpa_supplicant
4
  • I'm not missing that entry. Just forgot to mention it, sorry. hostapd works fine, but only after restarting the service and I wonder why.
    – jake
    Commented Oct 14, 2018 at 12:41
  • 1
    Ok. Second try. You are also missing the line nohook wpa_supplicant in dhcpcd.conf.
    – oh.dae.su
    Commented Oct 14, 2018 at 12:54
  • That will maybe solve it. I was anyhow wondering why there is a wpa_supplicant for wlan0 (which is the ap device). But when I kill this one I cannot connect anymore. But I'll try this. Thanks!
    – jake
    Commented Oct 14, 2018 at 13:14
  • It's working now. Thank you! If you add that to your answer, I will accept it.
    – jake
    Commented Oct 14, 2018 at 13:20

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.