JonC567
Posts: 5
Joined: Sat Jan 23, 2016 3:54 pm

isc dhcp server on a pi 2

Sat Jan 23, 2016 4:06 pm

I've installed the isc dhcp server on the pi 2, and if i start the service by sudo /etc/init.d/isc-dhcp-server start it all works, but it will not automatically load on boot. I've edited the /etc/defailt/isc-dhcp-server to provide the interface, the conf and PID locations.

The error message is:

Jan 23 15:27:27 pi dhcpd: No subnet declaration for eth0 (no IPv4 addresses).
Jan 23 15:27:27 pi dhcpd: ** Ignoring requests on eth0. If this is not what
Jan 23 15:27:27 pi dhcpd: you want, please write a subnet declaration
Jan 23 15:27:27 pi dhcpd: in your dhcpd.conf file for the network segment
Jan 23 15:27:27 pi dhcpd: to which interface eth0 is attached. **

There is a subnet declaration in the dhcpd.conf file, but I suspect the issue is that the dhcpd daemon is loading before the dhcpcd daemon has loaded. With the pi2, it is this daemon that is supplying the static address to the ether interface which is why I think this is the reason.

Is it possible to re-order the daemon boot order? so the dhcpcd completes loading before the dhcpd starts?

Thanks

ripat
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium

Re: isc dhcp server on a pi 2

Sat Jan 23, 2016 4:53 pm

If your OS is using systemd, can you post the result of:

Code: Select all

$ sudo  systemctl list-units
and

Code: Select all

$ sudo cat /lib/systemd/system/dhcpd.service
Using Linux command line usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

JonC567
Posts: 5
Joined: Sat Jan 23, 2016 3:54 pm

Re: isc dhcp server on a pi 2

Sat Jan 23, 2016 6:19 pm

$ sudo systemctl list-units
UNIT LOAD ACTIVE SUB DESCRIPTION
proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable Fil
sys-devices-platform-soc-3f201000.uart-tty-ttyAMA0.device loaded active plugged
sys-devices-platform-soc-3f300000.mmc-mmc_host-mmc0-mmc0:0007-block-mmcblk0-mmcblk
sys-devices-platform-soc-3f300000.mmc-mmc_host-mmc0-mmc0:0007-block-mmcblk0-mmcblk
sys-devices-platform-soc-3f300000.mmc-mmc_host-mmc0-mmc0:0007-block-mmcblk0.device
sys-devices-platform-soc-3f980000.usb-usb1-1\x2d1-1\x2d1.1-1\x2d1.1:1.0-net-eth0.d
sys-devices-virtual-sound-card0.device loaded active plugged /sys/devices/virtua
sys-devices-virtual-tty-ttyprintk.device loaded active plugged /sys/devices/virt
sys-module-configfs.device loaded active plugged /sys/module/configfs
sys-module-fuse.device loaded active plugged /sys/module/fuse
sys-subsystem-net-devices-eth0.device loaded active plugged SMSC9512/9514 Fast E
-.mount loaded active mounted /
boot.mount loaded active mounted /boot
dev-mqueue.mount loaded active mounted POSIX Message Queue File Syst
run-user-1000.mount loaded active mounted /run/user/1000
sys-fs-fuse-connections.mount loaded active mounted FUSE Control File System
sys-kernel-config.mount loaded active mounted Configuration File System
sys-kernel-debug.mount loaded active mounted Debug File System
systemd-ask-password-console.path loaded active waiting Dispatch Password Reques
systemd-ask-password-wall.path loaded active waiting Forward Password Requests t
session-c1.scope loaded active running Session c1 of user pi
avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
console-setup.service loaded active exited LSB: Set console font and key
cron.service loaded active running Regular background program pr
dbus.service loaded active running D-Bus System Message Bus
dhcpcd.service loaded active running dhcpcd on all interfaces
dphys-swapfile.service loaded active exited LSB: Autogenerate and use a s
fake-hwclock.service loaded active exited Restore / save the current cl
getty@tty1.service loaded active running Getty on tty1
hdparm.service loaded active exited LSB: Tune IDE hard disks
● isc-dhcp-server.service loaded failed failed LSB: DHCP server
kbd.service loaded active exited LSB: Prepare console
keyboard-setup.service loaded active exited LSB: Set preliminary keymap
kmod-static-nodes.service loaded active exited Create list of required stati
networking.service loaded active exited LSB: Raise network interfaces
ntp.service loaded active running LSB: Start NTP daemon
raspi-config.service loaded active exited LSB: Switch to ondemand cpu g
rc-local.service loaded active exited /etc/rc.local Compatibility
rsyslog.service loaded active running System Logging Service
serial-getty@ttyAMA0.service loaded active running Serial Getty on ttyAMA0
ssh.service loaded active running OpenBSD Secure Shell server
systemd-fsck-root.service loaded active exited File System Check on Root Dev
systemd-fsck@dev-mmcblk0p1.service loaded active exited File System Check on /d
systemd-journald.service loaded active running Journal Service
systemd-logind.service loaded active running Login Service
systemd-modules-load.service loaded active exited Load Kernel Modules
systemd-random-seed.service loaded active exited Load/Save Random Seed
systemd-remount-fs.service loaded active exited Remount Root and Kernel File
systemd-setup-dgram-qlen.service loaded active exited Increase datagram queue l
systemd-sysctl.service loaded active exited Apply Kernel Variables
systemd-tmpfiles-setup-dev.service loaded active exited Create Static Device No
systemd-tmpfiles-setup.service loaded active exited Create Volatile Files and D
systemd-udev-trigger.service loaded active exited udev Coldplug all Devices
systemd-udevd.service loaded active running udev Kernel Device Manager
systemd-update-utmp.service loaded active exited Update UTMP about System Boot
systemd-user-sessions.service loaded active exited Permit User Sessions
triggerhappy.service loaded active running LSB: triggerhappy hotkey daem
udev-finish.service loaded active exited Copy rules generated while th
user@1000.service loaded active running User Manager for UID 1000
-.slice loaded active active Root Slice
system-getty.slice loaded active active system-getty.slice
system-serial\x2dgetty.slice loaded active active system-serial\x2dgetty.slice
system-systemd\x2dfsck.slice loaded active active system-systemd\x2dfsck.slice
system.slice loaded active active System Slice
user-1000.slice loaded active active user-1000.slice
user.slice loaded active active User and Session Slice
avahi-daemon.socket loaded active running Avahi mDNS/DNS-SD Stack Activ
dbus.socket loaded active running D-Bus System Message Bus Sock
syslog.socket loaded active running Syslog Socket
systemd-initctl.socket loaded active listening /dev/initctl Compatibility Na
systemd-journald-dev-log.socket loaded active running Journal Socket (/dev/log)
systemd-journald.socket loaded active running Journal Socket
systemd-shutdownd.socket loaded active listening Delayed Shutdown Socket
systemd-udevd-control.socket loaded active running udev Control Socket
systemd-udevd-kernel.socket loaded active running udev Kernel Socket
var-swap.swap loaded active active /var/swap
basic.target loaded active active Basic System
cryptsetup.target loaded active active Encrypted Volumes
getty.target loaded active active Login Prompts
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
multi-user.target loaded active active Multi-User System
network-online.target loaded active active Network is Online
network.target loaded active active Network
paths.target loaded active active Paths
remote-fs-pre.target loaded active active Remote File Systems (Pre)
remote-fs.target loaded active active Remote File Systems
slices.target loaded active active Slices
sockets.target loaded active active Sockets
sound.target loaded active active Sound Card
swap.target loaded active active Swap
sysinit.target loaded active active System Initialization
timers.target loaded active active Timers
systemd-tmpfiles-clean.timer loaded active waiting Daily Cleanup of Temporary Di

LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.

94 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'
There is no /lib/systemd/system/dhcpd.service only a dhcpcd.service.

The isc-dhcp-server will manually start, but this output was taken before I started it.

ripat
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium

Re: isc dhcp server on a pi 2

Sat Jan 23, 2016 7:42 pm

Strange that it starts all right manually but not in bootup. What's the output of:

Code: Select all

awk '/### BEGIN/,/### END/' /etc/init.d/isc-dhcp-server
Using Linux command line usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

JonC567
Posts: 5
Joined: Sat Jan 23, 2016 3:54 pm

Re: isc dhcp server on a pi 2

Sat Jan 23, 2016 7:58 pm

### BEGIN INIT INFO
# Provides: isc-dhcp-server
# Required-Start: $remote_fs $network $syslog
# Required-Stop: $remote_fs $network $syslog
# Should-Start: $local_fs slapd $named
# Should-Stop: $local_fs slapd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: DHCP server
# Description: Dynamic Host Configuration Protocol Server
### END INIT INFO
It starts loading before dhcpcd loads the manual address, which I think causes the issue on boot up. Thanks

ripat
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium

Re: isc dhcp server on a pi 2

Sat Jan 23, 2016 8:10 pm

JonC567 wrote:It starts loading before dhcpcd loads the manual address, which I think causes the issue on boot up. Thanks
It is indeed the cause. Try to change the /etc/init.d/isc-dhcp-server file so to have:

Code: Select all

# Required-Start:    $all
And reboot.
Using Linux command line usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

JonC567
Posts: 5
Joined: Sat Jan 23, 2016 3:54 pm

Re: isc dhcp server on a pi 2

Sat Jan 23, 2016 8:34 pm

Thank you I tried that and rebooted, but the service doesn't look any different and still loads before the address is assigned to eth0.

JonC567
Posts: 5
Joined: Sat Jan 23, 2016 3:54 pm

Re: isc dhcp server on a pi 2

Sat Jan 23, 2016 9:52 pm

I've got this working now but putting in a delay start via a function in /etc/rc.local

Code: Select all

startdhcp()
{
sleep 30
/etc/init.d/isc-dhcp-server 
}

startdhcp &
Thank you your help.

Return to “Troubleshooting”