<div dir="ltr"><div class="gmail_extra"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>On 12 September 2017 at 10:47, Paul Wouters <span dir="ltr"><<a href="mailto:paul@nohats.ca" target="_blank">paul@nohats.ca</a>></span> wrote:<br></div></div></div></div></div></div></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, 12 Sep 2017, Duncan Stokes wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> I've added the elastic IP to lo on the AWS instance.<br>
<br>
To confirm this: you have bound the (public) elastic IP to the lo interface of the AWS instance?  I have never heard of this requirement it is certainly not required -<br>
and in fact might well be a contributing factor to the problem.<br>
</blockquote>
<br></span>
How else are you going to send packets with that source IP?<br>
<br>
the alternative is to use the pre-NAT IP, but the remote end<br>
might not like it, have conflicts, etc etc. By doing the<br>
elastic IP on loopback, the NAT is really just a NAT between<br>
the machines, and no pre-NAT IPs are visible anywhere.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
One of our AWS end configs (sanitised) below:<br>
conn ipsec-tunnel-00<br>
    type=tunnel<br>
    authby=secret<br>
    left=%defaultroute<br>
    leftid=<elastic IP of instance NOT bound anywhere on instance><br>
    leftnexthop=%defaultroute<br>
    leftsubnet=<instance subnet><br>
    leftsourceip=<instance eth0 ipv4 addr><br>
    right=<remote target public IP addr><br>
    rightsubnets=<target subnet><br>
    ....<br>
</blockquote>
<br></span>
Ahh you are building a site-to-site tunnel that does not involve the<br>
elastic IP itself. Yes binding the elastic IP is only needed if you<br>
build a tunnel from outside of AWS with destination ONLY the elastic IP.<span class="HOEnZb"><font color="#888888"><br><br></font></span></blockquote><div>Well, it does involve the EIP, but only as the right= IP in the config at the other end, i.e.: the tunnel target address that then gets NAT'd into the instance.</div><div><br></div><div>If you want to restrict traffic from only your instance, set your config leftid as the EIP, set the leftsubnet as a /32, and the leftsourceip as the ipv4 of the instance.</div><div><br></div><div>NB: I see at the end of my excerpt that I didn't tidy up the rightsubnets properly... as the config I copied I had a comma-delimited list of right subnets.  If there's only one, drop the pluralisation.</div><div><br></div><div>Regards,</div><div>Duncan.</div></div></div></div>