dhcpd after reboot

This forum is for discussion about general software issues.

dhcpd after reboot

Postby cincuranet » Thu Jul 17, 2014 9:40 am

I'm trying to setup DHCP server on Raspberry Pi, but I'm having small problems starting it properly after boot.

My dhcpd.conf is:
$this->bbcode_second_pass_code('', '
authoritative;
ddns-update-style standard;
ignore client-updates;

subnet 192.168.66.0 netmask 255.255.255.0 {
range 192.168.66.100 192.168.66.199;
option subnet-mask 255.255.255.0;
option routers 192.168.66.2;
option domain-name "foo.local";
option domain-name-servers 8.8.8.8, 8.8.4.4;
default-lease-time 1200;
max-lease-time 1200;
}
')

The dhcpd4.service:
$this->bbcode_second_pass_code('', '
[Unit]
Description=IPv4 DHCP server
After=network.target

[Service]
Type=forking
PIDFile=/run/dhcpd4.pid
ExecStart=/usr/sbin/dhcpd -4 -q -pf /run/dhcpd4.pid
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target
')

But after the Raspberry Pi is rebooted I get:
$this->bbcode_second_pass_code('', '
* dhcpd4.service - IPv4 DHCP server
Loaded: loaded (/usr/lib/systemd/system/dhcpd4.service; enabled)
Active: failed (Result: exit-code) since Thu 1970-01-01 01:00:13 CET; 44 years 6 months ago
Process: 117 ExecStart=/usr/sbin/dhcpd -4 -q -pf /run/dhcpd4.pid (code=exited, status=1/FAILURE)

Jan 01 01:00:13 x2raspi dhcpd[117]: Wrote 0 deleted host decls to leases file.
Jan 01 01:00:13 x2raspi dhcpd[117]: Wrote 0 new dynamic host decls to leases file.
Jan 01 01:00:13 x2raspi dhcpd[117]: Wrote 4 leases to leases file.
Jan 01 01:00:13 x2raspi dhcpd[117]:
Jan 01 01:00:13 x2raspi dhcpd[117]: Not configured to listen on any interfaces!
')

Forcing eth0 (the network card):
$this->bbcode_second_pass_code('', '
* dhcpd4.service - IPv4 DHCP server
Loaded: loaded (/usr/lib/systemd/system/dhcpd4.service; enabled)
Active: failed (Result: exit-code) since Thu 1970-01-01 01:00:13 CET; 44 years 6 months ago
Process: 117 ExecStart=/usr/sbin/dhcpd -4 -q -pf /run/dhcpd4.pid eth0 (code=exited, status=1/FAILURE)

Jan 01 01:00:13 x2raspi dhcpd[117]: Wrote 0 deleted host decls to leases file.
Jan 01 01:00:13 x2raspi dhcpd[117]: Wrote 0 new dynamic host decls to leases file.
Jan 01 01:00:13 x2raspi dhcpd[117]: Wrote 4 leases to leases file.
Jan 01 01:00:13 x2raspi dhcpd[117]:
Jan 01 01:00:13 x2raspi dhcpd[117]: No subnet declaration for eth0 (no IPv4 addresses).
Jan 01 01:00:13 x2raspi dhcpd[117]: ** Ignoring requests on eth0. If this is not what
Jan 01 01:00:13 x2raspi dhcpd[117]: you want, please write a subnet declaration
Jan 01 01:00:13 x2raspi dhcpd[117]: in your dhcpd.conf file for the network segment
Jan 01 01:00:13 x2raspi dhcpd[117]: to which interface eth0 is attached. **
Jan 01 01:00:13 x2raspi dhcpd[117]:
')

I believe it's because it starts before the IP address from /etc/netctl/eth0 was fully assigned. The eth0 file is:
$this->bbcode_second_pass_code('', '
Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address='192.168.66.4/24'
Gateway='192.168.66.2'
DNS=('8.8.8.8' '8.8.4.4')
ExecUpPost='/usr/bin/ntpd -gq || true'

## for DHCPv6
#IP6=dhcp
## for IPv6 autoconfiguration
IP6=stateless
')

Is it really because the IP address has not yet been configured? And if so, how I can make it start after it's configured (I tried also network-online.target, but that didn't help)?
Jiri {x2} Cincura
cincuranet
 
Posts: 8
Joined: Thu Jul 17, 2014 9:13 am

Re: dhcpd after reboot

Postby pepedog » Thu Jul 17, 2014 11:56 am

I'm not going to be much help because I'm going to suggest using dnsmasq.
A heads up also, systemd-networkd will be the default on images, took me minutes to figure out dhcp Ethernet and ntpd replacement (systemd-timesyncd)
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK


Return to General

Who is online

Users browsing this forum: No registered users and 16 guests

cron