Fixing isc-dhcp-server on Raspberry Pi

After my RaspberryPi WiFi router became borked I reinstalled Raspbian and reconfigured the AP, DHCP, and routing but ran into issues with the isc-dhcp-server not initializing properly on boot.  Starting from a console did work however so I was a little stumped.

The syslog contained the following:

Jun 21 14:13:43 raspberrypi dhcpd: Internet Systems Consortium DHCP Server 4.2.2
Jun 21 14:13:43 raspberrypi dhcpd: Copyright 2004-2011 Internet Systems Consortium.
Jun 21 14:13:43 raspberrypi dhcpd: All rights reserved.
Jun 21 14:13:43 raspberrypi dhcpd: For info, please visit https://www.isc.org/software/dhcp/
Jun 21 14:13:43 raspberrypi dhcpd: Internet Systems Consortium DHCP Server 4.2.2
Jun 21 14:13:43 raspberrypi dhcpd: Copyright 2004-2011 Internet Systems Consortium.
Jun 21 14:13:43 raspberrypi dhcpd: All rights reserved.
Jun 21 14:13:43 raspberrypi dhcpd: For info, please visit https://www.isc.org/software/dhcp/
Jun 21 14:13:43 raspberrypi dhcpd: Wrote 4 leases to leases file.
Jun 21 14:13:44 raspberrypi dhcpd:
Jun 21 14:13:44 raspberrypi dhcpd: No subnet declaration for wlan0 (no IPv4 addresses).
Jun 21 14:13:44 raspberrypi dhcpd: ** Ignoring requests on wlan0. If this is not what
Jun 21 14:13:44 raspberrypi dhcpd: you want, please write a subnet declaration
Jun 21 14:13:44 raspberrypi dhcpd: in your dhcpd.conf file for the network segment
Jun 21 14:13:44 raspberrypi dhcpd: to which interface wlan0 is attached. **
Jun 21 14:13:44 raspberrypi dhcpd:
Jun 21 14:13:44 raspberrypi dhcpd:
Jun 21 14:13:44 raspberrypi dhcpd: Not configured to listen on any interfaces!


Of course wlan0 was configured, as confirmed by ifconfig, and the service started fine from the console so I assumed the dhcpd server was attempting to start before wlan0 was up.

A quick Google search confirmed this issue and users suggested simply adding a 'sleep 5' to the dhcpd startup file /etc/init.d/isc-dhcp-server to stall it while the interface comes up.  A more elegant solution would be to add a loop while checking the state of the interface but this seems to be working just fine at least on my RPI.

Popular posts from this blog

Simple Raspberry Pi Interval Camera with Google Drive Upload

Loose Link Pins on the Huawei Watch (hwatch) Band

Erato Muse 5 True Wireless Bluetooth Earbud Review