I have successfully established an IPSec tunnel between my local Linux host and a remote VPN gateway. I am using virtual IPs assign by the gateway because being a roadwarrior my local LAN subnet is not fixed.
When it is up all traffic goes via the tunnel including internet traffic. What I would like is all traffic except for the local subnet to route throught the tunnel. I have read and re-read the Strongswan documentation but I cannot work out how to do this.
What do I need to do?
Local ipsec.conf
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
authby=secret
conn VPN
left=%any
leftsourceip=%config
leftid=@robin.my.net
leftfirewall=yes
right=52.n.n.n
rightsubnet=0.0.0.0/0
rightid=@vpn.my.net
auto=add
Server ipsec.conf
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
conn AWSVPN
left=%any
leftsubnet=172.31.38.36/32
leftid=@vpn.my.net
leftfirewall=yes
authby=secret
right=%any
rightsourceip=10.3.0.0/28
auto=add
Gateway
IP: 172.31.38.36 Subnet: 172.31.32.0/20
My machine
IP: 192.168.1.150 (can change) Subnet: 192.168.1.0/24 (can change) Virtual IP: 10.3.0.1 (assigned by Strongswan gateway)
EDIT:
I have managed to exclude the local network by adding this but the subnet is hardcoded:
conn local-net
leftsubnet=192.168.1.0/24
rightsubnet=192.168.1.0/24
authby=never
type=pass
auto=route