0

I have a VPN setup following this guide. I connect to the VPN from my Mac and I can confirm that both, my Mac as well as EC2 instances do have access to internet. However, for this to work, all my EC2 instances need to have a public static v4 IP. And I don't really want them to have a public IP for these EC2 instances but I do want internet connection. Of course, if I create a EC2 instance without public IP, then I have no internet connection from such instance.

From what I have been reading, I need a NAT Gateway. The problem is that I am not sure how to setup this in combination with the VPN setup I have.

Currently, this is what I have:

  • I have a VPC with IPv4 CIDR 172.31.0.0/16 and 3 subnets 172.31.32.0/20, 172.31.0.0/20 and 172.31.16.0/20
  • The VPC has an internet gateway attached.
  • I have a Client VPN endpoints with Client CIDR 10.0.0.0/22 and it has one of the subnets associated as "Target network associations". The one with 172.31.0.0/20.
  • The endpoint has a security group which does have a Outbound rules to allow all traffic.
  • The endpoint has a "Authorization rules" to allow all the VPC and Destination CIDR 172.31.0.0/16 and another rule for destination 0.0.0.0/0.
  • The endpoint has a "Route table" to allow all traffic for the selected subnet (172.31.0.0/20)

Any help would be appreciated.

2
  • Please edit your question to add a diagram if you want detailed help, lists of IPs and configurations is more difficult to understand. Generally though, you set up your NAT Gateway in a public subnet and route private IPs to the VPN and all other IPs to the NAT Gateway.
    – Tim
    Mar 16, 2023 at 19:49
  • As said before, generally, you would configure your public subnet with route 0.0.0.0/0 to your IGW, and a NAT; while your private subnet with route 0.0.0.0/0 to the NAT and 10.0.0.0/22 to the VPN.
    – palvarez
    Mar 17, 2023 at 12:55

1 Answer 1

0

I got an answer on another forum and I thought it was worth sharing it here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .