Public IPs and DNS not accessible

0

My EC2 instance I hosted recently cannot access the internet on its public IP 35.180.128.53. Also the DNS ec2-35-180-128-53.eu-west-3.compute.amazonaws.com is not also accessible. From the console terminal I execute this "netstat -rn" which shows only the private IP address. I couldn't figure out the problem with that;

Here is output from the terminal

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         172.31.32.1     0.0.0.0         UG        0 0          0 enX0
172.31.0.2      172.31.32.1     255.255.255.255 UGH       0 0          0 enX0
172.31.32.0     0.0.0.0         255.255.240.0   U         0 0          0 enX0
172.31.32.1     0.0.0.0         255.255.255.255 UH        0 0          0 enX0

Please how do I resolve this. I am new to cloud and this my first as I trying to host a laravel docker on the ecs .... Please help
Malachy
asked 8 months ago1741 views
2 Answers
1

Hello.
The EC2 public IP address is NATed and provided by AWS, so it cannot be confirmed by running the "netstat -rn" command from the OS.
Use metadata to check from EC2.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html#working-with-ip-addresses

View the IPv4 addresses
You can use the Amazon EC2 console to view the public and private IPv4 addresses of your instances. You can also determine the public IPv4 and private IPv4 addresses of your instance from within your instance by using instance metadata. For more information, see Instance metadata and user data.

The public IPv4 address is displayed as a property of the network interface in the console, but it's mapped to the primary private IPv4 address through NAT. Therefore, if you inspect the properties of your network interface on your instance, for example, through ifconfig (Linux) or ipconfig (Windows), the public IPv4 address is not displayed. To determine your instance's public IPv4 address from an instance, use instance metadata.

General troubleshooting procedures for when you cannot access the Internet from EC2 are described in the following documents.
https://repost.aws/knowledge-center/ec2-connect-internet-gateway

A common case is that the subnet on which the EC2 is running does not have a route to the Internet Gateway, or the network ACL or security group does not allow the necessary communication.

profile picture
EXPERT
answered 8 months ago
profile pictureAWS
EXPERT
iBehr
reviewed 8 months ago
0

Hi,

Because you provided public IP address and FQDN of your EC2 instance I can guess that you might not configured Security Group attached to the instance properly. Make sure it has appropriate rules for ingress.

profile picture
EXPERT
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions