Hi!
The systemd kamailio.service file for debian (in my case, it's stretch) has the following unit options set:
[Unit]
Description=Kamailio (OpenSER) - the Open Source SIP Server
After=network.target
It would be better to change this to:
[Unit]
Description=Kamailio (OpenSER) - the Open Source SIP Server
Wants=network-online.target
After=network-online.target
Why? With network.target the service starts as soon as the network setup is started, not explicitly after configuring (=IP) it [1].
This creates a race condition on very fast hardware like mine (booting incl. all services takes 10s).
Even with static IPs, kamailio often fails directly at boot because eth1 (connection to DB cluster) is not up.
[I have never met this problem on systems which ran on HDDs.]
Setting "network-online.target" as Wants + After makes sure, Kamailio is started after all interfaces are ready to serve.
Units that strictly require a configured network connection should pull in network-online.target
(via a Wants=
type dependency) and order themselves after it. This target unit is intended to pull in a service that delays further execution until the network is sufficiently set up. What precisely this requires is left to the implementation of the network managing service.
Perfect example for this is the Shorewall package (firewall solution):
[Unit]
Description=Shorewall IPv4 firewall
Wants=network-online.target
After=network-online.target
Conflicts=iptables.service firewalld.service
RFC
Kind regards
Kevin