1

Running on Astra Linux 1.3, my dhcp service (isc-dhcp-server) is well-configured now and work as expected with a slight nuance - it works only when it's started, but a system don't run it at startup. Doing sudo update-rc.d isc-dhcp-server defaults doesn't help. Another services can be added to (and removed from) autostart this way since this is native to this SysV based system. What I have to do to make it run? Thanks.

P.S. uname -a gives

3.2.0-27-generic

Right after reboot, sudo service --status-all gives

[ - ] isc-dhcp-server

Dmitry Ilukhin
  • 121
  • 1
  • 1
  • 6
  • the `isc-dhcp-server` doesn't like to start if it is configured to serve networks/subnets that it doesn't have an interface on. Could it be that the dhcpd service is starting (or trying to) before the network cards are active? – ivanivan Mar 20 '18 at 18:37
  • Tried some methods to force it to wait for a network or just put it before network daemon on startup sequence, no effect. It seems it just not started by init. – Dmitry Ilukhin Mar 22 '18 at 11:10
  • `update-rc.d isc-dhcp-server` gives no error. /etc/rc*.d shows it's scripts is placed after wicd's ones (number SNN* is bigger). And last, it doesn't put any message to syslog that it could if it is started in a wrong environment. – Dmitry Ilukhin Mar 22 '18 at 11:17
  • placed $wicd into required-start section into /etc/init.d/isc-dhcp-server, no effect – Dmitry Ilukhin Mar 22 '18 at 11:23
  • It seems I need to use cron watchdog to observe isc-dhcp-server or something – Dmitry Ilukhin Mar 22 '18 at 13:09

4 Answers4

3

I use Ubuntu Server 18.04 and I was facing a similar problem: the isc-dhcp-server won't automatically start. For me, it turns out the problem was that the service was disabled; executing sudo systemctl enable isc-dhcp-server fixed it for me.

1

As ivanivan said, daemon didn't start because of all network interfaces were down. So I've decided to call start script again after they start. My system uses wicd as network manager and it can call some scripts when network state changes.

Kind of hack, but it's working. I've placed a script into /etc/wicd/scripts/postconnect :

sleep 60
/etc/init.d/isc-dhcp-server start

and voila, daemon starts as expected.

Note: sleep 60 is required since network starts working exactly after 60 seconds after script is called.

Dmitry Ilukhin
  • 121
  • 1
  • 1
  • 6
1

Neither of the above answers worked for me, so I also did a hack - I edited /etc/init.d/isc-dhcp-server and added a sleep 20 to the beginning of the start command in the script, so changed so it looks like the following:

case "$1" in
    start)
        sleep 20         # <--- added this line (without the comment)
        test_config
        log_daemon_msg "Starting $DESC" "$NAME"
        start-stop-daemon --start --quiet --pidfile "$DHCPD_PID" \
            --exec /usr/sbin/dhcpd -- \
            -q $OPTIONS -cf "$DHCPD_CONF" -pf "$DHCPD_PID" $INTERFACES
        sleep 2

        if check_status -q; then
            log_end_msg 0
        else
            log_failure_msg "check syslog for diagnostics."
            log_end_msg 1
            exit 1
        fi
        ;;

Now it works (after an initial delay of 20 seconds of course).

dmcgrandle
  • 121
  • 6
0

I have the interfaces configured via dhcpcd5, since the isc-dhcp-server fails to start because the interfaces aren't yet configured at boot time I created the /etc/dhcpcd.exit-hook file and added this command:

/bin/systemctl start isc-dhcp-server

An example of commands that can be placed inside this file can be find at this link. Now isc-dhcp-server starts regularly every time that the system boots!