With iptables you can set marks on traffic and that way decide which tunnel to use. Automatic switch will not be supported, unless you write a script that checka the health of the current actively tunnel and then change mark.<br><br>Probably traditional routes can work better.<br><br>---- John Brown skrev ----<br><br><div dir="ltr"><div><div><div><div><div>Hi Dusan,<br></div>The solution you propose is also promising, thank you! But I do not get one thing. How can I use iptables to decide which tunnel should be used to send the traffic? Would your solution provide automatic switchover in case of preffered tunnel is going down and maybe up again (for example, many failure scenarios are possible)?<br><br></div><div>Best regards,<br></div><div>John<br></div></div></div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-08-24 13:24 GMT+02:00 Dusan Ilic <span dir="ltr"><<a href="mailto:dusan@comhem.se" target="_blank">dusan@comhem.se</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi John,<br><br>You dont need route based for this, you can setup two tunnels with same rightsubnet and use different marks. By applying these marks with iptables you choose which tunnel to send the traffic to.<br><br>Vti (and maybe libipsec) is however cleaner solution, cause the vti puts the mark on all packets routed out that interface, so standard routing logic can be used instead. Not sure about libipsec though, i think you will have to use iptables marking then too.<br><br>---- John Brown skrev ----<div class="HOEnZb"><div class="h5"><br><br><div dir="ltr"><div><div><div>Thank you very much for an advice. It looks interesting but also adds significant complexity to the solution. Did you find route based VPN working for rightsubnet overlap scenario?<br><br></div>I'm going to try this probably but with libipsec rather that vti devices (kernel too old for vti). As far as I understand the solution you've proposed I can add priorities to the tunnels by adding a metrics to routes (and prefer conn1 over conn2). Am I correct?<br><br></div>Best regards,<br></div>John<br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-08-24 11:34 GMT+02:00 Vincent Bernat <span dir="ltr"><<a href="mailto:bernat@luffy.cx" target="_blank">bernat@luffy.cx</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> ❦ 24 août 2017 11:27 <a href="tel:+0200" target="_blank">+0200</a>, John Brown <<a href="mailto:jb20141125@gmail.com" target="_blank">jb20141125@gmail.com</a>> :<br>
<span><br>
> I'm searching the net but cannot find reliable answer for problem:<br>
><br>
> Is this possible in strongswan to have two connections with the same<br>
> rightsubnet entry and prefer one connection over another?<br>
><br>
> For example:<br>
><br>
> ...<br>
><br>
> conn1<br>
> ...<br>
> rightsubnet=<a href="http://10.10.0.0/16" rel="noreferrer" target="_blank">10.10.0.0/16</a><br>
><br>
> conn2<br>
> ...<br>
> rightsubnet=<a href="http://10.10.0.0/16" rel="noreferrer" target="_blank">10.10.0.0/16</a><br>
><br>
><br>
> and in ideal scenario both conns are up but conn1 is used for tx/rx<br>
> encrypted traffic when possible, conn2 only in case of lack of conn1.<br>
<br>
</span>One solution is to use routes to divert traffic to one of the tunnel or<br>
the other:<br>
<a href="https://wiki.strongswan.org/projects/strongswan/wiki/RouteBasedVPN" rel="noreferrer" target="_blank">https://wiki.strongswan.org/p<wbr>rojects/strongswan/wiki/RouteB<wbr>asedVPN</a><br>
<span class="m_-1804133613441265563HOEnZb"><font color="#888888">--<br>
Use self-identifying input. Allow defaults. Echo both on output.<br>
- The Elements of Programming Style (Kernighan & Plauger)<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>