<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Thanks Paul, I shall take your advice and give it a go.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Much appreciated.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Kind Regards</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 5 Sep 2019 at 22:02, Paul Wouters <<a href="mailto:paul@nohats.ca">paul@nohats.ca</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">On Thu, 5 Sep 2019, Greg Langford wrote:<br>
<br>
> My tunnel to my Mikrotik Router establishes without issue, I can send traffic over the tunnel both directions. However when I try and connect my road warrior via any<br>
> connectivity method be that cellular or wifi. The connection is matching the first found configuration in Libreswan which is incorrect. The host to host configuration does<br>
> not use xauth, however my Android VPN client does use xauth.<br>
<br>
The connection matching should "switch" the the right connection when<br>
more information becomes available. The first packet(s) do not contain<br>
the remote ID yet, so it is not always possible to match the right<br>
connection on the initial packet.<br>
<br>
> Is there a way to configure a connection e.g the site to site connection to only specifically serve requests from a certain ID or certificate?<br>
<br>
No because the first packet is just the DH key exchange and you will not<br>
have any IDs yet.<br>
<br>
> Is it possible to use two different server certificates on Libreswan with different CN's e.g <a href="http://vpn1.domain.com" rel="noreferrer" target="_blank">vpn1.domain.com</a> and <a href="http://road-warriors.domain.com" rel="noreferrer" target="_blank">road-warriors.domain.com</a> to do this?<br>
<br>
Yes, and with IKEv2 that is often done for multi-tenant systems because<br>
with IKEv2 the remote client can send what it thinks the ID of the <br>
server is (The IDr payload, AKA the "me Tarzan, you Jane" mechanism)<br>
<br>
But note that:<br>
- Windows does not support IDr (big sigh)<br>
- Android does not support IKEv2 (big sigh, but you can install the<br>
   strongswan android client for IKEv2)<br>
<br>
When using IKEv1 because of android, be sure to use Aggressive Mod<br>
(aggressive=yes) so that the IDs come in more quickly and connection<br>
switching can happen. That usually also means using XAUTH.<br>
<br>
We have configuration examples on the libreswan wiki<br>
<br>
Paul<br>
> <br>
> I have been trying various configurations but the road warriors are always matching mikrotik-home not road-warriors.<br>
> <br>
> Thank you in advance for your help.<br>
> <br>
> My two configurations are as follows.<br>
> <br>
> conn mikrotik-home<br>
> left=%defaultroute<br>
> leftsubnet=<a href="http://10.200.200.1/32" rel="noreferrer" target="_blank">10.200.200.1/32</a><br>
> leftsourceip=10.200.200.1<br>
> leftcert=<server cert name><br>
> right=%any<br>
> rightsubnet=<a href="http://10.200.200.2/32" rel="noreferrer" target="_blank">10.200.200.2/32</a><br>
> rightid=@<id sent by mikrotik><br>
> ike=aes128-sha1;modp1024<br>
> dpddelay=5<br>
> dpdtimeout=15<br>
> dpdaction=clear<br>
> auto=add<br>
> <br>
> conn road-warriors<br>
>     left=176.58.106.154<br>
>     leftcert=<server cert name><br>
>     leftsendcert=always<br>
>     leftsubnet=<a href="http://0.0.0.0/0" rel="noreferrer" target="_blank">0.0.0.0/0</a><br>
>     rightaddresspool=10.20.30.1-10.20.30.254<br>
>     right=%any<br>
>     modecfgdns=8.8.8.8,8.8.4.4<br>
>     # Versions up to 3.22 used modecfgdns1 and modecfgdns2<br>
>     #modecfgdns1=193.110.157.123<br>
>     #modecfgdns2=8.8.8.8<br>
>     leftxauthserver=yes<br>
>     rightxauthclient=yes<br>
>     leftmodecfgserver=yes<br>
>     rightmodecfgclient=yes<br>
>     modecfgpull=yes<br>
>     xauthby=alwaysok<br>
>     ike-frag=yes<br>
>     # xauthby=pam<br>
>     # xauthfail=soft<br>
>     # Can be played with below<br>
>     # dpddelay=30<br>
>     # dpdtimeout=120<br>
>     # dpdaction=clear<br>
>     #authby=rsasig<br>
>     pfs=no<br>
>     auto=add<br>
>     rekey=no<br>
> <br>
> Kind Regards,<br>
> Greg Langford<br>
> <br>
><br>
</blockquote></div>