How to access/ping a server located on AWS?

2020-05-14 03:44发布

With what address should a server located on AWS be accessed?

I've created an AWS instance and installed a web server on it. However the server is not reachable via any of the:

  1. ec2-174-129-24-92.compute-1.amazonaws.com
  2. the IP address from instance's ifconfig
  3. an elastic IP address I've created on the AWS dashboard and associated with the instance

Surprisingly, ssh with root@ec2-174-129-24-92.compute-1.amazonaws.com works fine.

What might be the problem and how to bind an address to the instance?

10条回答
叛逆
2楼-- · 2020-05-14 04:26

Updated for 2014 - the current Amazon UI no longer uses numbers for ICMP types, so the existing answer doesn't work anymore.

In your security group:

  • Click the inbound tab
  • Create a custom ICMP rule
  • Select echo request
  • Use range 0.0.0.0/0 for everyone or lock it down to specific IPs
  • Apply the changes

and you'll be able to ping.

AWS Console Image

查看更多
老娘就宠你
3楼-- · 2020-05-14 04:26

Give 2 rules in AWS security group (Inbound),

Custom ICMP Rule       Echo Request          N/A            0.0.0.0/0

Custom ICMP Rule       Echo Reply            N/A             0.0.0.0/0
查看更多
Animai°情兽
4楼-- · 2020-05-14 04:28

Ping doesn't work with EC2 because ping runs over the ICMP protocol which is blocked in a typical EC2 security group configuration.

Here's a very nifty way to work around this by using tcping (a ping alternative that works over a TCP port):

tcping ec2-174-129-24-92.compute-1.amazonaws.com

tcping ec2-174-129-24-92.compute-1.amazonaws.com 22

It runs on port 80 (the first example) but you can also specify a different port (the second example) to be used to test connectivity.

查看更多
聊天终结者
5楼-- · 2020-05-14 04:41

I found that if you install a VPN server on your AWS server, you can connect to the VPN and ping the private IP address in the virtual private network.

查看更多
登录 后发表回答