Skip to content

Ping the outside world from an EC2 instance behind a NAT

Marc Grossouvre edited this page Oct 11, 2019 · 1 revision

Pre-requisites

Connect to an EC2 instance in SSH mode with PuTTY

Let us say you want to ping google.com .

It might not work even though you are connected with SSH from the internet. The common issue is that you have created a "default NAT" when creating a VPC with public and private network. By default, access to this NAT is restricted to its own security group. You must modify that in the Security Group rules of your NAT instance :

  • either you just modify the source on the existing line selecting Anywhere for instance
  • or (more secure) you remove this line and open your ports one by one. In that case you need the "All ICMP -IPv4" rule (with source Anywhere) that will open the network to ping and ping response.

Now it should work !