<div dir="ltr">Thanks Peter. Implementing all of your suggestions. nat_traversal was already set to yes since I built that Gist but the rest of your suggestions still apply.<div><br></div><div>-J</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 3, 2014 at 1:31 PM, Peter McGill <span dir="ltr"><<a href="mailto:petermcgill@goco.net" target="_blank">petermcgill@goco.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-CA" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">First of all your NAT Traversal settings don’t match.<u></u><u></u></span></p><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">You have </span>nat_traversal=no<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> in ipsec.conf,<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">but </span>forceencaps=yes<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> in tunnel.conf which is ignored because of ipsec.conf,<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">and nat traversal enabled in fortigate (disabled in openswan).<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Also, your keylife settings don’t match, that is how long the phase 2 tunnel is good for.<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">This is likely the cause of your issue, same thing happened to me when these were out of sync with a cisco device.<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Ie) Tunnel is up for a while, then drops and doesn’t come back (at least not for an hour or more).<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">This happens because one side thinks the tunnel hasn’t expired, and the other side has expired the tunnel.<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Openswan defaults to 8 hours for phase 2 and 1 hour for phase 1, for some reason other vendors sometimes switch the two.<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">You’ve correctly altered ikelifetime in tunnel.conf (openswan) to 8h to match the fortigate 8 hours.<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">But you have not set keylife=1800 in tunnel.conf (openswan) to match the 30 minutes (1800) set in fortigate phase 2.<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Also, I would majorly increase the Kbytes keylife setting on the fortigate, you wouldn’t want the tunnel to expire before the 30 minutes,<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">or you could run into the same issue again.<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Also DPD is disabled on the openswan and enabled on the fortigate.<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">To setup DPD to match the fortigate settings, try the following in your tunnel.conf:<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">                    dpddelay=10<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">                    dpdtimeout=40<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">                    dpdaction=restart<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Note: 10 seconds is pretty low, I run mine at 30 and 120. 30 between each keepalive and restart tunnel at 120 (3/4 failed keep alives).<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">1 final note, you don’t specify dh group 5 in your openswan tunnel.conf, but you do in the fortigate.<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">It doesn’t appear to be causing a problem, but you may wish to know you can specify it in tunnel.conf as follows:<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">                    i</span><span lang="FR" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">ke=3des-md5-modp1536<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">It doesn’t work on the esp line, but esp defaults to whatever ike uses, so it works…<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></pre><pre><u></u> <u></u></pre><p class="MsoNormal"><span lang="FR" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Peter McGill<u></u><u></u></span></p><p class="MsoNormal"><span lang="FR" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><a href="tel:519-284-3420%20x204" value="+15192843420" target="_blank">519-284-3420 x204</a><u></u><u></u></span></p><p class="MsoNormal"><span lang="FR" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Jason J. W. Williams [mailto:<a href="mailto:jasonjwwilliams@gmail.com" target="_blank">jasonjwwilliams@gmail.com</a>] <br><b>Sent:</b> December-03-14 2:57 PM</span></p><div><div class="h5"><br><b>To:</b> Peter McGill<br><b>Cc:</b> <<a href="mailto:users@lists.openswan.org" target="_blank">users@lists.openswan.org</a>><br><b>Subject:</b> Re: Weird tunnel issue<u></u><u></u></div></div><p></p></div><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">Got some more debugging on this issue. <u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">When the tunnel drops (after a network outage), I can only get the tunnel passing traffic again by restarting the ipsec daemon. But the daemon doesn't restart the tunnel on its own despite DPD being configured. Restarting the tunnel from the Fortigate side, the Fortigate shows the tunnel up but the no traffic will route on the OpenSWAN side.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt;font-family:"Arial","sans-serif"">ipsec.conf: </span><a href="https://gist.github.com/williamsjj/4dc00138e62697aec602" target="_blank"><span style="font-size:9.5pt;font-family:"Arial","sans-serif"">https://gist.github.com/williamsjj/4dc00138e62697aec602</span></a><span style="font-size:9.5pt;font-family:"Arial","sans-serif""><br>tunnel config: </span><a href="https://gist.github.com/williamsjj/910adcc5a071fc130b30" target="_blank"><span style="font-size:9.5pt;font-family:"Arial","sans-serif"">https://gist.github.com/williamsjj/910adcc5a071fc130b30</span></a><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Fortigate Phase 1 Conf: <a href="http://www.screencast.com/t/9V3XmL9Gdxw" target="_blank">http://www.screencast.com/t/9V3XmL9Gdxw</a><u></u><u></u></p></div><div><p class="MsoNormal">Fortigate Phase 2 Conf: <a href="http://www.screencast.com/t/EZq5VSbcMWS" target="_blank">http://www.screencast.com/t/EZq5VSbcMWS</a><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Incident #1 error logs: <a href="https://gist.github.com/williamsjj/0b1b58fe8bb216ccf275" target="_blank">https://gist.github.com/williamsjj/0b1b58fe8bb216ccf275</a><u></u><u></u></p></div><div><p class="MsoNormal">Incident #2 error logs: <a href="https://gist.github.com/williamsjj/d84bad0d8cc6b43ecef7" target="_blank">https://gist.github.com/williamsjj/d84bad0d8cc6b43ecef7</a><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Any help/advice is greatly appreciated.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">-J<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Thu, Oct 23, 2014 at 1:11 PM, Peter McGill <<a href="mailto:petermcgill@goco.net" target="_blank">petermcgill@goco.net</a>> wrote:<u></u><u></u></p><p class="MsoNormal">So it is...<br><br>No I would expect --down to fully stop the tunnel, at least on openswan end.<br><br>But firewall/iptables is another thing which can prevent traffic flow... so<br>I mentioned it.<br><br>Something else to watch on interrop is that your using all the same<br>settings.<br>Can you get a screenshot, etc... of the fortigate configuration.<br><br>What are the syslog entries at the time the connection stops working?<br><br>Can you show us ipsec auto --status output, during the issue?<br><span style="color:#888888"><br><span>Peter McGill</span></span><u></u><u></u></p><div><div><p class="MsoNormal" style="margin-bottom:12.0pt"><br><br>-----Original Message-----<br>From: Jason J. W. Williams [mailto:<a href="mailto:jasonjwwilliams@gmail.com" target="_blank">jasonjwwilliams@gmail.com</a>]<br>Sent: October-23-14 12:50 PM<br>To: Peter McGill<br>Cc: <<a href="mailto:users@lists.openswan.org" target="_blank">users@lists.openswan.org</a>><br>Subject: Re: Weird tunnel issue<br><br>The second file is what's included. Have not tried using iptables. Is "ipsec<br>auto --down" not sufficient?<br><br>-J<br><br>Sent via iPhone<br><br>> On Oct 23, 2014, at 9:28, "Peter McGill" <<a href="mailto:petermcgill@goco.net" target="_blank">petermcgill@goco.net</a>> wrote:<br>><br>> Well your ipsec.conf includes files in /etc/ipsec.conf.d which you haven't<br>> shown us, so we can't actually examine your configuration.<br>><br>> However, have you tried restarting and disabling the firewall (iptables<br>> rules) to see if that fixes the problem.<br>><br>> Peter McGill<br>> <a href="tel:519-284-3420%20x204" target="_blank">519-284-3420 x204</a><br>><br>> -----Original Message-----<br>> Date: Wed, 22 Oct 2014 14:00:11 -0700<br>> From: "Jason J. W. Williams" <<a href="mailto:jasonjwwilliams@gmail.com" target="_blank">jasonjwwilliams@gmail.com</a>><br>> To: <a href="mailto:users@lists.openswan.org" target="_blank">users@lists.openswan.org</a><br>> Subject: [Openswan Users] Weird tunnel issue<br>> Message-ID:<br>>    <CAHZAEpceRYd-EBco6_yPw=<a href="mailto:G9p88aCvY3ZeAb3Q%2BsaqbaGo6VCg@mail.gmail.com" target="_blank">G9p88aCvY3ZeAb3Q+saqbaGo6VCg@mail.gmail.com</a>><br>> Content-Type: text/plain; charset=UTF-8<br>><br>> Hi,<br>><br>> We've had a weird issue where the tunnel had been up for several days<br>> and then suddenly refused to route packets over the tunnel (couldn't<br>> ping). The tunnel according to "ipsec auto --status" was up. The other<br>> side is a Fortigate 200B and it also agreed the tunnel was up. But it<br>> refused to send traffic over the tunnel. Tried toggling the tunnel<br>> down and then up from both ends, and while the tunnel re-established<br>> still couldn't route. Only thing that corrected it was rebooting the<br>> box running the OpenSWAN client.<br>><br>> Client is an Ubuntu 14.04.1 x64 box:<br>> # ipsec --version<br>> Linux Openswan U2.6.38/K3.13.0-37-generic (netkey)<br>><br>> ipsec.conf: <a href="https://gist.github.com/williamsjj/4dc00138e62697aec602" target="_blank">https://gist.github.com/williamsjj/4dc00138e62697aec602</a><br>> tunnel config: <a href="https://gist.github.com/williamsjj/910adcc5a071fc130b30" target="_blank">https://gist.github.com/williamsjj/910adcc5a071fc130b30</a><br>><br>> Any help is greatly appreciated.<br>><br>> -J<br>><u></u><u></u></p></div></div></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></blockquote></div><br></div>