Had only one public subnet to VPC, and added NAT g

2019-09-21 10:31发布

问题:

I had only one public subnet to VPC,and added NAT gateway to that public subnet, but i'm not able access the instance using NAT ip address.

@1)I'm able to ping the instance, with public Ip address(added icmp to security group), but by using NAT elastic IP address i'm not able to ping.

@2)Does NAT is applicable for single public subnet or not. My goal is to translate the ip address attached to public subnet instance.

回答1:

I believe you are using the wrong service for what you are trying to do.

The AWS service NAT Gateway is for routing outbound traffic from a private subnet to the internet. It does not route inbound requests.



回答2:

Make sure you have:

  1. Internet Gateway for your VPC (docs).
  2. A public IPv4 for your instance.

NAT Gateway (docs) is used for services inside a private subnet (which is inside a VPC) to send requests from inside the subnet to internet. The source address being the Elastic IP.

Internet Gateway is used for all the VPC to establish a basic level of internet connectivity. It takes care of routing to your EC2 instances that have a public IP.



回答3:

I have solution on this, give NAT gateway private IP to private server @ DNS place, then you will get internet access. if you want to test u need to have one server with public IP, then take remote of 2nd(private server) and Test it will work. for any other info https://www.youtube.com/channel/UCEYPy7Dt4UJa_UvUrsRmjoQ https://www.linkedin.com/in/mohan-reddy-79a57014b/