We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

SirGizmo
Posts: 3
Joined: Mon Nov 12, 2018 1:40 am

DHCP Server fails to start on boot

Mon Nov 12, 2018 1:51 am

I am trying to get my Raspberry Pi to become a DHCP server for my home network. I can get the DHCP server to work properly and my devices get an IP address if I type sudo dhcpd -cf /etc/dhcp/dhcpd.conf in the terminal.
If I reboot the Pi the DHCP server does hand out address and looking at the logs the dhcp fails.

Nov 10 16:07:28 raspberrypi dhcpd[436]: Wrote 12 leases to leases file.
Nov 10 16:07:28 raspberrypi dhcpd[436]:
Nov 10 16:07:28 raspberrypi dhcpd[436]: No subnet declaration for eth0 (no IPv4 addresses).
Nov 10 16:07:28 raspberrypi dhcpd[436]: ** Ignoring requests on eth0. If this is not what
Nov 10 16:07:28 raspberrypi dhcpd[436]: you want, please write a subnet declaration
Nov 10 16:07:28 raspberrypi dhcpd[436]: in your dhcpd.conf file for the network segment
Nov 10 16:07:28 raspberrypi dhcpd[436]: to which interface eth0 is attached. **
Nov 10 16:07:28 raspberrypi dhcpd[436]:
Nov 10 16:07:28 raspberrypi dhcpd[436]:
Nov 10 16:07:28 raspberrypi dhcpd[436]: Not configured to listen on any interfaces!
Nov 10 16:07:28 raspberrypi dhcpd[436]:
Nov 10 16:07:28 raspberrypi dhcpd[436]: If you think you have received this message due to a bug rather
Nov 10 16:07:28 raspberrypi dhcpd[436]: than a configuration issue please read the section on submitting
Nov 10 16:07:28 raspberrypi dhcpd[436]: bugs on either our web page at www.isc.org or in the README file
Nov 10 16:07:28 raspberrypi dhcpd[436]: before submitting a bug. These pages explain the proper
Nov 10 16:07:28 raspberrypi dhcpd[436]: process and the information we find helpful for debugging..
Nov 10 16:07:28 raspberrypi dhcpd[436]:
Nov 10 16:07:28 raspberrypi dhcpd[436]: exiting.

Any clue as to why the DHCPD will not start on boot but will run properly when I manually start the service?

User avatar
thagrol
Posts: 14535
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: DHCP Server fails to start on boot

Mon Nov 12, 2018 2:31 pm

One possibility: does it try to read a different config file when started during boot up?

You can test this by manually starting it with

Code: Select all

sudo dhcpd -f
to let it load its config from the default location.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

SirGizmo
Posts: 3
Joined: Mon Nov 12, 2018 1:40 am

Re: DHCP Server fails to start on boot

Mon Nov 12, 2018 11:43 pm

I tried that command and the dhcpd service started without any errors.
I tried to find another dhcp config file but I could not find one.

User avatar
thagrol
Posts: 14535
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: DHCP Server fails to start on boot

Tue Nov 13, 2018 1:56 pm

The only other possibility I can think of is that it's being started before the network is up.

Check "wait for network" is enabled in raspi-config or (and this is a hack) disable the systemd service and start it manually with a time delay via rc.local or cron
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

mfa298
Posts: 1386
Joined: Tue Apr 22, 2014 11:18 am

Re: DHCP Server fails to start on boot

Tue Nov 13, 2018 3:25 pm

thagrol wrote:
Tue Nov 13, 2018 1:56 pm
The only other possibility I can think of is that it's being started before the network is up.

Check "wait for network" is enabled in raspi-config or (and this is a hack) disable the systemd service and start it manually with a time delay via rc.local or cron
To add to that you might want to consider how the Pi has it's IP address assigned to it.

For a DHCP server the address needs to be statically and needs to be up before the system tries to start dhcpd. In my case (I run isc-dhcp-server on a Pi2 here) I've removed the dhcpcd package (apt-get purge dhcpcd5) and manually configure the IP address via the old /etc/network/interfaces type method (actually using /etc/network/interfaces.d/eth0 as the config is automated).

User avatar
thagrol
Posts: 14535
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: DHCP Server fails to start on boot

Tue Nov 13, 2018 5:13 pm

Yeah, I should have thought of that.

FYI, my dnsmasq based dhcp server has a static IP address assigned in /etc/dhcpcd.conf (along with staticly defind routers and DNS servers) and has "Wait for Network at Boot" set to "Yes". It's also the only dhcp server on my LAN.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

SirGizmo
Posts: 3
Joined: Mon Nov 12, 2018 1:40 am

Re: DHCP Server fails to start on boot

Tue Nov 13, 2018 11:31 pm

Looks like it is now working.
I removed the dhcpcd package (apt-get purge dhcpcd5) and added the static IP to /etc/network/interfaces.d/eth0.

porrascarlos80
Posts: 2
Joined: Thu Nov 26, 2020 12:34 am

Re: DHCP Server fails to start on boot

Thu Nov 26, 2020 1:07 am

I am having problems to boot dhcpd on rasp 3b

is it needed to edit this file?
/etc/dhcpcd.conf

I followed all the steps listed here , except 3 and 6
http://www.noveldevices.co.uk/rp-dhcp-server

not applicable for 3b?

drjoms
Posts: 2
Joined: Sat Nov 28, 2020 1:38 pm

Re: DHCP Server fails to start on boot

Sat Nov 28, 2020 1:53 pm

try 'systemctl status dhcpcd'
It may give you more idea.

also, '** Ignoring requests on eth0.' and 'Not configured to listen on any interfaces!' - are quite self explanatory.

try 'systemctl start dhcpcd' and see what errors that produces.
Thargol may also be onto something. But then error message says 'Ignoring requests on eth0' - kidn of assumes that eth0 exists. With that said, it may be a red herring. check DHCP config. Did you mess with it?

bls
Posts: 4556
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: DHCP Server fails to start on boot

Sat Nov 28, 2020 3:47 pm

porrascarlos80 wrote:
Thu Nov 26, 2020 1:07 am
I am having problems to boot dhcpd on rasp 3b

is it needed to edit this file?
/etc/dhcpcd.conf

I followed all the steps listed here , except 3 and 6
http://www.noveldevices.co.uk/rp-dhcp-server

not applicable for 3b?
Here are two forum posts that you may find useful: viewtopic.php?f=28&t=292384 and viewtopic.php?f=28&t=270859
Pi tools:
Quickly and easily build customized exactly as-you-want SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure IPSEC/IKEV2 VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

Return to “Networking and servers”