I just wanted to send an update based on some feedback. My subject is misleading so let me clarify. I'm not attempting to nat between the networks on either side of the vpn. For examples sake assume 192.168.0.0/24 on one side of tunnel and 10.10.10.0/24 on the other. I'm trying to allow servers on one side 10.x of the tunnel to access the internet via the other side of the tunnel 192.168.0.1. Egress works, 10.x client gets to the internet and replies come back. The return traffic comes back and the gateway drops it. I assume that pf translates it back to the 10.x address and has no route for that. I need it to go back through enc0.
J -----Original Message----- From: owner-m...@openbsd.org [mailto:owner-m...@openbsd.org] On Behalf Of Justin Mayes Sent: Wednesday, May 27, 2015 2:47 PM To: misc@openbsd.org Subject: NATing out enc0 traffic Greetings everyone I am playing with amazon virtual private clouds (VPC). I have set a few up. I have no issues connecting ipsec from openbsd <-> amazon VPC. All of these VPCs so far have their own internet connection going out from amazon that works fine. [OpenBSD]<--------ipsec--------->[VPC]<----------------->Internet Next I am setting up a VPC that has no internet gateway. Instead the default gateway is the vpn and all traffic is sent back through the ipsec tunnel and then out the local network gateway. [Internet] ^ | | | [OpenBSD]<-------ipsec------>[VPC] I added these relevant lines to pf.conf Match out on $ext_if from !($ext_if:network) nat-to ($ext_if) pass quick on enc0 keep state (if-bound) With tcpdump and pfctl I can tell that traffic from the vpc (10.0.0.0/8) comes across the tunnel and gets NATed out. I can see that traffic leave the external interface and I can see the reply come back to the external interface. The reply never hits enc0 though and never makes it back to the client. Is there another piece to the setup I am missing? I assume what I am trying to do is possible. I would appreciate any insight or advice anyone may have in regards to this type of setup. J