Nirmal Raghavan
Nirmal Raghavan

Reputation: 602

IPV4 traffic not working with AWS egress only internet gateway

I have assigned an egress only internet gateway to my private subnet. Now I can connect with IPV6 websites but not with IPV4 addresses.

Do I need NAT gateways to access IPV4 address from my EC2 machine? (Only outgoing traffic)

Upvotes: 4

Views: 2894

Answers (2)

Yes, you need a NAT Gateway to access IPv4 websites from your EC2 instance in private subnet.

To make the instance in private subnet to access both IPv4 and IPv6 websites, we need:

  • NAT Gateway (Only IPv4 outgoing traffic)
  • Egress Only Internet Gateway (Only IPv6 outgoing traffic)

Don't forget to assign an IPv6 address to the instance in private subnet otherwise the instance cannot access IPv6 websites.

*A public IPv4 address is not needed for the instance in private subnet. We can access IPv4 websites without it.

Moreover, with the commands below, we can check if the connections to IPv4 and IPv6 websites are available from the instance in private subnet.

For IPv4 websites:

ping -4 google.com

For IPv6 websites:

ping -6 google.com

Upvotes: 1

colde
colde

Reputation: 3322

You need either a NAT Gateway, or simply an Internet Gateway. But if you are only interested in outgoing, then a NAT Gateway is the way to go.

Egress only internet gateways are for IPv6 only. As mentioned in the documentation for them.

Upvotes: 5

Related Questions