简体   繁体   中英

AWS VPC using EC2 as NAT not working

I can't connect to the internet. I

1) Setup an EC2 instance in a public subnet of my VPC and with a public IP

2) Enabled all inbound and outbound traffic for the security group (just to make sure things work and that this shouldn't be an issue).

3) Disabled destination/source checks on my public EC2 instance

4) My main route table (which is the one associated with my private subnet) routes traffic from 0.0.0.0/0 to my public EC2 instance

5) Launched an instance in my private subnet in the same VPC as my public instance (without an elastic or public ip)

6) I can successfully SSH to my public instance and run ping ietf.org

7) I can successfully SSH to my private instance from my public instance, BUT ping ietf.org times out

What else should I be doing?

I made a mistake when setting up my EC2 instance. I was meant to set it up from an AMI of a machine with nat specific configurations on it. Otherwise I'd have to install them myselves.

An AMI type for this is amzn-ami-vpc-nat , I overlooked this line in the documentation

In hindsight I would just use the NAT gateway service AWS provides now. However it could be more expensive in the long run so compare the VPC pricing and the EC2 instance pricing

Disabled destination/source checks - This is wrong, you should not disable this check on EC2, it's only for NAT. Please disable this and make sure your instance has a public IP or Elastic IP address.

-Pankaj

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM