<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 17.01.20 15:37, Sergey Safarov
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAHtxdDe-hd_gWdWc2N2SL=WZfG=k2COvnu+cBcVykymR1h9xBw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr"><font color="#0000ff">Not strictly related, but
            if someone is aware or had some experiences<br>
            with,  I am curious if "echo 'del 0' >
            /proc/rtpengine/control" is<br>
            really needed because on a system where I forgot to have it
            in the<br>
            scripts (well, was commented), I haven't noticed any issues
            after<br>
            rtpengine restarts.</font>
          <div><br>
            <div>Could you clarify of correct order rtpengine start?</div>
            <div>What is happen if ipables have rule</div>
          </div>
          <div>```<br>
            iptables -I INPUT -p udp -j RTPENGINE --id 0<br>
            ```</div>
        </div>
      </div>
    </blockquote>
    <p><br>
    </p>
    <p>AFAIK, if the rule is already in iptables, nothing should happen,
      all is ok.</p>
    <p><br>
    </p>
    <blockquote type="cite"
cite="mid:CAHtxdDe-hd_gWdWc2N2SL=WZfG=k2COvnu+cBcVykymR1h9xBw@mail.gmail.com">
      <div dir="ltr">And then rtpengine failed to start?</div>
    </blockquote>
    <p><br>
    </p>
    <p>If the rule in iptables doesn't exist, rtpengine starts fine, but
      is doing user space forwarding, not kernel forwarding. Calls run
      fine, only that more cpu is used on rtpengine system (and maybe a
      little bit more delay, but nothing that can be noticed or to worry
      about) -- cpu usage is still low for couple of hundred active
      calls (when I tested), so it is not easy to notice always if the
      rtpengine does user space forwarding or kernel based forwarding.
      That's why I asked here to see what would be the best way to
      ensure everything is prepared for kernel based forwarding.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <p><br>
    </p>
    <blockquote type="cite"
cite="mid:CAHtxdDe-hd_gWdWc2N2SL=WZfG=k2COvnu+cBcVykymR1h9xBw@mail.gmail.com">
      <div dir="ltr">
        <div>Is any issue here?<br>
          <div><br>
            <div class="gmail_quote">
              <div dir="ltr" class="gmail_attr">On Fri, Jan 17, 2020 at
                5:30 PM Sergey Safarov <<a
                  href="mailto:s.safarov@gmail.com"
                  moz-do-not-send="true">s.safarov@gmail.com</a>>
                wrote:<br>
              </div>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
                0.8ex;border-left:1px solid
                rgb(204,204,204);padding-left:1ex">
                <div dir="ltr">
                  <div><font color="#0000ff">Systemd seems to have the
                      "ExecStartPre" option, is it what people use<br>
                      to ensure the rtpengine kernel module is loaded
                      and iptables rule exists?</font><br>
                  </div>
                  <div><br>
                  </div>
                  yes, that is option<br>
                  But this command will be executed for Every daemon
                  start.<br>
                  <br>
                  <font color="#0000ff">Any systemd-specific wayt to run
                    a script only once after system boot? I<br>
                    have seen workarounds on the net for creating like a
                    rc.local service,<br>
                    but they didn't look to be systemd-native</font>
                  <div><br>
                    <div>I can recommend create dedicated systemd unit
                      file "prepare-rtpengine.service"<br>
                      Like this<br>
                      <br>
                    </div>
                  </div>
                  <div><font color="#0000ff">[Unit]<br>
                      Description=prepare rpengine<br>
                      <br>
                      [Service]<br>
                      Type=oneshot<br>
                      RemainAfterExit=yes<br>
                      ExecStartPre=/usr/sbin/modprobe xt_RTPENGINE<br>
                      ExecStart=/usr/sbin/iptables -I INPUT -p udp -j
                      RTPENGINE --id 0<br>
                      ExecStartPost=ip6tables -I INPUT -p udp -j
                      RTPENGINE --id 0<br>
                      StandardOutput=syslog<br>
                      StandardError=syslog<br>
                      <br>
                      [Install]<br>
                      RequiredBy=rtpengine.service<br>
                      WantedBy=basic.target</font><br>
                  </div>
                  <div><br>
                  </div>
                  <div>and then<br>
                    <font color="#0000ff">systemctl
                      enable prepare-rtpengine.service</font></div>
                  <div><br>
                    This will create dependency that will be execute one
                    tme before rtpengine daemon started.</div>
                  <div><br>
                  </div>
                </div>
                <br>
                <div class="gmail_quote">
                  <div dir="ltr" class="gmail_attr">On Fri, Jan 17, 2020
                    at 5:03 PM Daniel-Constantin Mierla <<a
                      href="mailto:miconda@gmail.com" target="_blank"
                      moz-do-not-send="true">miconda@gmail.com</a>>
                    wrote:<br>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0px 0px
                    0px 0.8ex;border-left:1px solid
                    rgb(204,204,204);padding-left:1ex">Hello,<br>
                    <br>
                    do people here have (implemented) special ways to
                    properly start<br>
                    rtpengine with kernel forwarding after system
                    reboot?<br>
                    <br>
                    From rtpengine readme:<br>
                    <br>
                    """<br>
                    <br>
                    A typical start-up sequence including in-kernel
                    forwarding might look<br>
                    like this:<br>
                    <br>
                    # this only needs to be one once after system (re-)
                    boot<br>
                    modprobe xt_RTPENGINE<br>
                    iptables -I INPUT -p udp -j RTPENGINE --id 0<br>
                    ip6tables -I INPUT -p udp -j RTPENGINE --id 0<br>
                    <br>
                    # ensure that the table we want to use doesn't exist
                    - usually needed<br>
                    after a daemon<br>
                    # restart, otherwise will error<br>
                    echo 'del 0' > /proc/rtpengine/control<br>
                    <br>
                    # start daemon<br>
                    /usr/sbin/rtpengine --table=0
                    --interface=10.64.73.31<br>
                    --interface=2001:db8::4f3:3d \<br>
                    --listen-ng=<a href="http://127.0.0.1:2223"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">127.0.0.1:2223</a>
                    --tos=184 --pidfile=/run/rtpengine.pid<br>
                    --no-fallback<br>
                    <br>
                    """<br>
                    <br>
                    I was relying on shell scripts executed on boot
                    time, but now that<br>
                    systemd is more common, I am looking to see what are<br>
                    "standard"/"recommended" ways for running additional
                    scripts besides the<br>
                    start/stop daemon, which makes it also easier to
                    build packages not<br>
                    worrying about the type of OS and how it can run
                    scripts at startup.<br>
                    <br>
                    Systemd seems to have the "ExecStartPre" option, is
                    it what people use<br>
                    to ensure the rtpengine kernel module is loaded and
                    iptables rule exists?<br>
                    <br>
                    Any systemd-specific wayt to run a script only once
                    after system boot? I<br>
                    have seen workarounds on the net for creating like a
                    rc.local service,<br>
                    but they didn't look to be systemd-native, ...<br>
                    <br>
                    Not strictly related, but if someone is aware or had
                    some experiences<br>
                    with,  I am curious if "echo 'del 0' >
                    /proc/rtpengine/control" is<br>
                    really needed because on a system where I forgot to
                    have it in the<br>
                    scripts (well, was commented), I haven't noticed any
                    issues after<br>
                    rtpengine restarts.<br>
                    <br>
                    Cheers,<br>
                    Daniel<br>
                    <br>
                    -- <br>
                    Daniel-Constantin Mierla -- <a
                      href="http://www.asipto.com" rel="noreferrer"
                      target="_blank" moz-do-not-send="true">www.asipto.com</a><br>
                    <a href="http://www.twitter.com/miconda"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">www.twitter.com/miconda</a>
                    -- <a href="http://www.linkedin.com/in/miconda"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">www.linkedin.com/in/miconda</a><br>
                    Kamailio World Conference - April 27-29, 2020, in
                    Berlin -- <a href="http://www.kamailioworld.com"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">www.kamailioworld.com</a><br>
                    <br>
                    <br>
                    _______________________________________________<br>
                    Kamailio (SER) - Users Mailing List<br>
                    <a href="mailto:sr-users@lists.kamailio.org"
                      target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
                    <a
                      href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                  </blockquote>
                </div>
              </blockquote>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio World Conference - April 27-29, 2020, in Berlin -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>