I'm trying to setup DHCP server on Raspberry Pi on Arch Linux, but I'm having small problems starting it properly after boot.
My dhcpd.conf is:
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:
[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:
* 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):
* 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:
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)?