[英]AWS - Cannot ping EC2 instance on private subnet in VPC
My goal is to create an EC2 instance in a private subnet on a VPC that I will be able to ping from external internet.我的目标是在 VPC 上的私有子网中创建一个 EC2 实例,我将能够从外部 Internet ping 通该实例。
So far, I have:到目前为止,我有:
When I try to ping the elastic IP address, then pings time out.当我尝试 ping 弹性 IP 地址时,ping 超时。
What do I need to be able to do to ping the EC2 instance on the private subnet?我需要做什么才能 ping 私有子网上的 EC2 实例?
Your Amazon EC2 instance is in a private subnet. 您的Amazon EC2实例位于私有子网中。 Therefore, it cannot be reached from the Internet. 因此,无法从互联网上联系到它。 This is good! 这很好! That is why private subnets exist. 这就是私有子网存在的原因。
Therefore, you correctly cannot ping the private instance from the Internet. 因此,您无法从Internet ping私有实例。
In fact, when you ping the Elastic IP address associated with the NAT Gateway, you are actually pinging the NAT Gateway, not the instance. 实际上,当您ping与NAT网关关联的弹性IP地址时,您实际上正在ping NAT网关,而不是实例。 The NAT Gateway is either rejecting the requests and/or has a security group that does not permit inbound ICMP requests. NAT网关要么拒绝请求,要么/或者有一个不允许入站ICMP请求的安全组。
The NAT Gateway allows outbound communication from resources in a private subnet to the Internet. NAT网关允许从私有子网中的资源到Internet的出站通信。 It does not forward inbound requests. 它不转发入站请求。 This is per design. 这是每个设计。
Actually I think the right thing you need to is connect public and private subnets through a Route Table.实际上,我认为您需要做的正确事情是通过路由表连接公共和私有子网。
Destination Target
10.0.0.0/16 local
0.0.0.0/0 nat-gateway-id
https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Scenario2.html https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Scenario2.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.