Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #206274

systemd: how to start a service (kea DHCP4) after all network interfaces are up?

From Markus Schönhaber <debian-user@list-post.mks-mail.de>
Newsgroups linux.debian.user
Subject systemd: how to start a service (kea DHCP4) after all network interfaces are up?
Date 2019-03-16 12:50 +0100
Message-ID <xCfZ7-3w0-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

I have installed the kea DHCP4 server on a machine running recent
stretch and two ethernet interfaces. kea is configured to answer DHCP
requests on one of the interfaces.
On boot, the kea-dhcp4-server.service is started but doesn't work. It
logs this:
> DHCPSRV_OPEN_SOCKET_FAIL failed to open socket: the interface enp3s0 is down or has no usable IPv4 addresses configured
After manually restarting the service it works fine.

It seems that the DHCP server is started while the interface it is
configured to listen on is not yet up and therefore refuses to work.
How can I make sure that the kea-dhcp4-server.service is started no
sooner than after all network interfaces are up?

What I've tried:
1 Copied /lib/systemd/system/kea-dhcp4-server.service to
  /etc/systemd/system and added
  Wants=networking.service
  After=networking.service
  to the [Unit] section of the copy.
  The problem remained.
2 Created a shell script that does a
  sleep 5
  before exec'ing the original
  /usr/sbin/kea-dhcp4 -c /etc/kea/kea-dhcp4.conf
  and replaced the unit's ExexStart line with the path to this script.

2 does indeed help: the dhcp server works as it should after a reboot.
Well, this is a workaround at best, a terrible mess at worst, but it's
definitely not a solution. So I hope someone can answer my question above.

-- 
Regards
  mks

Back to linux.debian.user | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

systemd: how to start a service (kea DHCP4) after all network  interfaces are up? Markus Schönhaber <debian-user@list-post.mks-mail.de> - 2019-03-16 12:50 +0100
  Re: systemd: how to start a service (kea DHCP4) after all network  interfaces are up? john doe <johndoe65534@mail.com> - 2019-03-16 14:40 +0100
    Re: systemd: how to start a service (kea DHCP4) after all network  interfaces are up? Markus Schönhaber <debian-user@list-post.mks-mail.de> - 2019-03-16 19:40 +0100
      Re: systemd: how to start a service (kea DHCP4) after all network interfaces are up? Sven Joachim <svenjoac@gmx.de> - 2019-03-16 21:30 +0100
        Re: systemd: how to start a service (kea DHCP4) after all network  interfaces are up? Markus Schönhaber <debian-user@list-post.mks-mail.de> - 2019-03-17 17:20 +0100
  Re: systemd: how to start a service (kea DHCP4) after all network  interfaces are up? Greg Wooledge <wooledg@eeg.ccf.org> - 2019-03-18 13:50 +0100
    Re: systemd: how to start a service (kea DHCP4) after all network  interfaces are up? Markus Schönhaber <debian-user@list-post.mks-mail.de> - 2019-03-18 14:30 +0100
      Re: systemd: how to start a service (kea DHCP4) after all network  interfaces are up? Curt <curty@free.fr> - 2019-03-18 18:50 +0100
  Re: systemd: how to start a service (kea DHCP4) after all network  interfaces are up? Henning Follmann <hfollmann@itcfollmann.com> - 2019-03-18 20:30 +0100
    Re: systemd: how to start a service (kea DHCP4) after all network  interfaces are up? Markus Schönhaber <debian-user@list-post.mks-mail.de> - 2019-03-18 21:00 +0100

csiph-web