[英]Cannot ping AWS EC2 instance with public IP
I cannot ping my EC2 instance with which has a public IP associated with it.我无法 ping 具有与其关联的公共 IP 的 EC2 实例。 Before posting here, I read Cannot ping AWS EC2 instance .
在此处发帖之前,我阅读了无法 ping AWS EC2 实例。 It didn't help:
它没有帮助:
Here's how I have things set up:以下是我如何设置:
I created a new Amazon Linux t2.micro instance using all the defaults.我使用所有默认值创建了一个新的 Amazon Linux t2.micro 实例。
After creation, it didn't have an IPv4 Public IP in the EC2 |创建后,EC2中没有IPv4公网IP | INSTANCES |
实例 | Instances.
实例。
So I went to EC2 |所以我去了EC2 | NETWORK & SECURITY |
网络与安全 | Elastic IPs, and clicked the Allocate Elastic IP address button.
弹性 IP,然后单击分配弹性 IP 地址按钮。 After the Public IPv4 address column showed an address, I clicked Actions |
在公共 IPv4 地址列显示地址后,我单击操作 | Associate Elastic IP address.
关联弹性 IP 地址。
I went back to EC2 |我回到EC2 | INSTANCES |
实例 | Instances, and the IPv4 Public IP column shows the address I just created.
Instances,IPv4 Public IP列显示我刚刚创建的地址。
Still cannot ping.还是ping不通。
So I went to EC2 |所以我去了EC2 | NETWORK & SECURITY |
网络与安全 | Security Groups, clicked the link for the security group associated with the instance and added an inbound and outbound rule like so:
安全组,单击与实例关联的安全组的链接并添加入站和出站规则,如下所示:
All traffic All All 0.0.0.0/0
All ICMP - IPv4 ICMP All 0.0.0.0/0
Still cannot ping.还是ping不通。
So I went to VPC |所以我去了VPC | Internet Gateways, clicked the Create internet gateway button, selected the defaults, and then attached the internet gateway to the VPC which is associated with the instance.
Internet 网关,单击创建 Internet 网关按钮,选择默认值,然后将 Internet 网关附加到与实例关联的 VPC。
Still cannot ping.还是ping不通。
So I went to VPC |所以我去了VPC | SECURITY |
安全 | Network ACLs, Edit Inbound and Edit Outbound rules.
网络 ACL、编辑入站和编辑出站规则。 This is what I have for both:
这就是我对两者的拥有:
Rule # Type Protocol Port Range Source Allow / Deny
100 ALL Traffic ALL ALL 0.0.0.0/0 ALLOW
101 All ICMP - IPv4 ICMP (1) ALL 0.0.0.0/0 ALLOW
Still cannot ping.还是ping不通。
What else is missing to be able to ping?还缺少什么才能ping通? Yes, I can ping other hosts on my network... just not to AWS and the public IP address listed for that EC2 instance.
是的,我可以 ping 网络上的其他主机……只是不能 ping 到 AWS 和为该 EC2 实例列出的公共 IP 地址。
First, it is worth mentioning that there should generally be no need to every modify the Network ACLs.首先,值得一提的是,一般不需要每次修改网络 ACL。 They can be used for special purposes (eg creating a network DMZ), but otherwise just leave them at their default values.
它们可用于特殊目的(例如,创建网络 DMZ),但除此之外,只需将它们保留为默认值即可。
I should also mention that using PING
generally isn't worthwhile because it can be blocked by many network configurations.我还应该提到,使用
PING
通常是不值得的,因为它可以被许多网络配置阻止。 Rather than trying to get Ping to work, you should try to get whatever it is that you actually want to work, to work.而不是试图让 Ping 工作,你应该尝试让你真正想要工作的任何东西工作。 For example, if you wish to SSH into the instance or use it as a web server, try to get them working rather than Ping.
例如,如果您希望通过 SSH 连接到实例或将其用作 Web 服务器,请尝试让它们工作而不是 Ping。
Here are the things that would be necessary to get PING to work:以下是使 PING 正常工作所必需的事情:
0.0.0.0/0
to an Internet Gateway (You did not mention the Route Table in your Question.)0.0.0.0/0
定向到Internet 网关的路由表条目的子网(您没有在问题中提到路由表。)0.0.0.0/0
)0.0.0.0/0
)的入站 ICMP 流量的安全组 So, based on the information you have provided, you should confirm that the subnet has a Route Table that points to the Internet Gateway .因此,根据您提供的信息,您应该确认子网具有指向Internet 网关的路由表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.