Ok so first of all, networking is really not my strong suit...
I have an Amazon Linux EC2 instance, ip 172.31.46.176, connected to a IPSEC VPN using strongswan :
conn aws-to-other
type=tunnel
auto=start
keyexchange=ikev2
authby=secret
# IP locale serveur
left=172.31.46.176
# IP publique serveur
leftid=XX.XX.XX.XX
# Sous réseau local
leftsubnet=10.255.254.0/24
# IP publique distante
right=YY.YY.YY.YY
# Sous réseau distant
rightsubnet=172.16.91.0/24
ike=aes256-sha2_256-modp2048!
esp=aes256-sha256-modp2048!
aggressive=no
keyingtries=%forever
ikelifetime=86400s
lifetime=3600s
dpddelay=30s
dpdtimeout=120s
dpdaction=restart
The link is up and connected.
The other host is using also 172.16.X.X IPs. In order to contact its machine with IP 172.16.91.213, I have to set up a NAT rule to appear like my IP is FROM 10.255.254.0/24.
So far :
I enabled IP Forwarding (/proc/sys/net/ipv4/ip_forward)
I disabled source/dest check on my EC2 instance network configuration
I tried iptables -t nat -A POSTROUTING -s 10.255.254.0/24 -o eth0 -m policy --dir out --pol ipsec -j ACCEPT iptables -t nat -A POSTROUTING -s 10.255.254.0/24 -o eth0 -j MASQUERADE
from https://wiki.strongswan.org/projects/strongswan/wiki/ForwardingAndSplitTunneling
I've been playing around with iptables rules, but so far not so good.
I'm at loss, if anyone can point me in any direction, I'd be really greatful.
Thanks