Feb 102013

So, I figured out why wlan0 doesn’t get an IP address when hostapd starts up.
ifplugd messes about with the interfaces when they go up and down, so the simplest solution is to disable ifplugd for wlan0 !
in /etc/default/ifplugd, the default configuration is this

ARGS="-q -f -u0 -d10 -w -I"

Simply changing it to this

ARGS="-q -f -u0 -d10 -w -I"

will ensure that wlan0 will not lose it’s static IP address that’s configured in /etc/network/interfaces when wlan0 goes up.


  49 Responses to “How To : Use The Raspberry Pi As A Wireless Access Point/Router Part 3…B!”

  1. You saved my day! I had exactly this issue on my Pi and now I am a happy camper! Thank you!

  2. Same problem here with the “vanishing” IP address if hostapd comes up. But I also don’t (and don’t think I need) /etc/default/ifplugd

    Are there other solutions?

  3. […] Help with hostapd and IP: http://sirlagz.net/2013/02/10/how-to-use-the-raspberry-pi-as-a-wireless-access-pointrouter-part-3b/ […]

  4. Very helpful, this also solved my problem, cheers mate!

  5. I have to say that to make Raspberry Pi to really work as AP I had to come a long way. I hope others will find this page faster. Every article how to make raspberry PI wifi AP (hostapd + isc-dhcp-server ) should have a link to this page

  6. God bless you!!! So many nerve cell killed on this stupid issue…

  7. Thank you for the solution to the final step in my journey towards RPI AP. Madman you may be but hopefully this wil stop me going the same way. 8)

  8. God bless you man 😀

    This joke has turned me crazy for almost a full day. The problem is that I did the same configuration (a RasPi in AP mode) nearly 6 months ago, without any problem, but using an Occidentalis distro at that time. It seems that updates brought by NOOBS Raspbian has broken something (kernel is not the same BTW).

    Peta-thanks to you for providing us this workaround.

  9. very helpful, thanks!

  10. Awesome, thanks for sharing =)

  11. Thank you SO MUCH for this. I wish I found this before I burned a whole day…

  12. Hi,

    can you tell me, how your /etc/network/interfaces looks?

    I configured this:
    GNU nano 2.2.6 Datei: /etc/network/interfaces

    auto lo
    iface lo inet loopback

    iface eth0 inet static

    iface wlan0 inet static

    but when the system is rebootet, there is no wlan0 up:
    ifconfig says:

    eth0 Link encap:Ethernet Hardware Adresse xx:xx:xx:xx:xx:xx
    inet Adresse: Bcast: Maske:
    RX packets:881 errors:0 dropped:0 overruns:0 frame:0
    TX packets:567 errors:0 dropped:0 overruns:0 carrier:0
    Kollisionen:0 Sendewarteschlangenlänge:1000
    RX bytes:89254 (87.1 KiB) TX bytes:147534 (144.0 KiB)

    lo Link encap:Lokale Schleife
    inet Adresse: Maske:
    UP LOOPBACK RUNNING MTU:65536 Metrik:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    Kollisionen:0 Sendewarteschlangenlänge:0
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    When I try sudo ifup wlan0 it says
    Missing required variable: address
    Missing required configuration variables for interface wlan0/inet.
    Failed to bring up wlan0.

    After I do sudo ifconfig wlan0 netmask
    The wlan0 is up.

    wlan0 Link encap:Ethernet Hardware Adresse xx:xx:xx:xx:xx:xx
    inet Adresse: Bcast: Maske:
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    Kollisionen:0 Sendewarteschlangenlänge:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    After a reboot, I have set the IP again.

    What I doing wrong?


  13. I habe a solution now,

    In /etc/rc.local addet
    sudo ifconfig wlan0 netmask

    now the network wlan0 is up after everry reboot.

  14. My goodness, thank you for this! ^^
    Was wondering what was happening w/ my Pi

  15. Perfect

  16. Great Tutorial really easy to follow! I have just started out with the Pi and found this book very interesting/helpful it details everything you need for starting out (not that you need it by the looks of things!) http://amzn.to/1zJaBnN

  17. you are the fucking master!!, thanks a lot!

  18. Ahhhhhhhhh! I can’t believe that finally did it. Days on & off wasted on this one.

    I had restorted to an ugly /etc/rc.local hack taking down my 2nd interface, killing it & restarting was the only way I could get wlan0 back up after hostapd started up on wlan1.

    I’m doing with this two wireless interfaces… and it’s working smoothly. Thanks a million!


    • Hi sanner,
      this is exactly what I am looking for.
      I am very new to Raspi and Linux.
      Could you tell me more about how you did this / what steps I have to take / what settings to modify to make it work with two wireless interfaces?
      Will clients be able to connect to wlan1 and work with the Raspi even if wlan0 is down / Interrnet connection lost in your setup?
      Thank you, Klaus

  19. Cheers buddy!!

  20. Thank you!!
    this is exactly what was happening to me. i think the hostapd was causing the wlan0 interface to bounce so it lost it IP and broke my DHCP service. took me an hour to spot it!

  21. Thank you very much for saving my sleepless nights.

    I went crazy when each time I connect to wlan1, wlan0 will drop.

    I will link to your site from my awesome website: http://www.linuxcircle.com

  22. […] with wlan0 no ip – see this page dnsmasq-dhcp[2297]: DHCP packet received on wlan0 which has no address in /etc/default/ifplugd, the […]

  23. […] found the answer just following the instructions on the last page of a sirlagz post. I did this and it […]

  24. I tried all the above and no success.
    It worked only if I add the line in the service daemon itself
    /etc/rc.local & /etc/default/ifplugd were not touched.

    case "$1" in
    log_daemon_msg "Starting $DESC" "$NAME"
    ####################### added next line #################
    sudo ifconfig wlan0 netmask

    start-stop-daemon --start --quiet --pidfile "$DHCPD_PID" \
    --exec /usr/sbin/dhcpd -- \

    • Perhaps things have changed since I’ve written the post.

      I’ll get another Raspberry Pi working as an AP and revisit this post 🙂

  25. OMG Thanks for this, wasted a day of my life before I found this solution! Hostapd now working

  26. Thanks so much for this!!

    I had a very odd problem where hostapd would work fine if my raspberry pi was booted with a hdmi monitor connected – but wouldn’t work if the hdmi wasn’t connected. This fix has solved it. I assume the hdmi monitor did something to the boot sequence which also fixed the problem.

  27. Forgive me if this isn’t the right place to make this post but I’m getting desperate. I’m trying to make my Raspberry Pi B+ running Raspian-Jessie into an 802.11ac access point using an Edimax EW-7811UAC adapter. Edimax tech support provided me with a pre-compiled binary and it seems to work fine when I’m using the Pi as a client on my home network.

    However, after following the procedure on another website to make my Pi an access point, I get to the point where my mobile client can see the access point and can report the speed of the connection but is unable to obtain an IP address. None of the solutions offered on the other website helped which is how I ended up here.

    The solution offered here involves editing the /etc/default/ifplugd file but my /etc/default directory has no file by that name. I suspect your using a different way of handling DHCP but I can’t seem to find Parts 1 & 2 of your procedure to try it out. Can anyone offer any suggestions on how to fix my problem or at least provide a link to your complete procedure?

  28. I don’t understand, I did sudo nano /etc/default/ifplugd and found that this file is empty on my own Raspberry2+…

  29. How would I do this with two WLAN interfaces instead of eth0 and wlan0?
    (Raspi 2B+ with 2 Edimax adapaters)
    wlan0 connects to a router for Internet access and clients connect to wlan1
    The clients should maintain connection to Raspi regardless of whether wlan0 is connected or not.

    I am very new to Raspi and Linux – obviously.
    sanner (post 24) figured it out but didn’t elaborate.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>