<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi!<div><br></div><div>The systemd kamailio.service file for debian (in my case, it's stretch) has the following unit options set:</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">[Unit]<br>Description=Kamailio (OpenSER) - the Open Source SIP Server<br>After=network.target</blockquote></div><div><br></div><div>It would be better to change this to:</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">[Unit]<br>Description=Kamailio (OpenSER) - the Open Source SIP Server<br>Wants=network-online.target<br>After=network-online.target</blockquote><div><br></div><div>Why? With network.target the service starts as soon as the network setup is started, not explicitly after configuring (=IP) it [1].</div></div><div>This creates a race condition on very fast hardware like mine (booting incl. all services takes 10s).</div><div><br></div><div>Even with static IPs, kamailio often fails directly at boot because eth1 (connection to DB cluster) is not up.</div><div>[I have never met this problem on systems which ran on HDDs.]</div><div><br></div><div>Setting "network-online.target" as Wants + After makes sure, Kamailio is started after all interfaces are ready to serve.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium">Units that strictly require a configured network connection should pull in </span><code class="gmail-filename" style="color:rgb(0,0,0)">network-online.target</code><span style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium"> (via a </span><code class="gmail-varname" style="color:rgb(0,0,0)">Wants=</code><span style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium"> 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.</span>  </blockquote><div><br></div><div>Perfect example for this is the Shorewall package (firewall solution):</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">[Unit]<br>Description=Shorewall IPv4 firewall<br>Wants=network-online.target<br>After=network-online.target<br>Conflicts=iptables.service firewalld.service</blockquote></div><div><br></div><div>RFC</div><div><br></div><div>Kind regards</div><div>Kevin</div><div><br></div><div>[1] <a href="https://www.freedesktop.org/software/systemd/man/systemd.special.html">https://www.freedesktop.org/software/systemd/man/systemd.special.html</a></div></div></div></div></div></div></div>