Why is public ip network on ubunutu but public ip not on amazon linux?

0

When set to the same security group as the same vpc, When ec2 created using ubuntu images, the server was accessible by public ip. However, when created under the same conditions, there was unaccessible by public ip ec2 based on Amazon linux images. (Of course, we're done setting up inbound in the security group)

Does anyone know why? (Both has been accessible in terminal by ssh)

2 Answers
3
Accepted Answer

The presence (or absence) of a default public IP address is determined by the setting for the subnet into which the instance is being launched https://docs.aws.amazon.com/vpc/latest/userguide/vpc-ip-addressing.html#vpc-public-ipv4-addresses

This can be selected in AWS Console when you launch the instance.

Enter image description here

Could it be that you have launched the Ubuntu instance in a subnet that has public IPs enabled, but Amazon Linux is in a subnet where public IPs are disabled by default?

profile picture
EXPERT
Steve_M
answered 10 months ago
profile picture
EXPERT
reviewed 10 months ago
profile picture
EXPERT
reviewed 10 months ago
profile picture
EXPERT
reviewed 10 months ago
  • Thanks for reply! but, I mean, A public ip has been created, but when I access the ip or ping from a web browser such as Chrome, the response that it is closed.

  • Is the Amazon Linux instance (the one you can't access) in the same subnet as Ubuntu (which is fine)?

    If Amazon Linux is in a different subnet to Ubuntu, then the subnet needs to be internet-facing, which means it needs to have a route to an internet gateway.

    Answering a ping needs inbound ICMP to be open in the security group. A web browser needs a webserver to be listening on the port at the other end (unlikely if you can't login to the EC2 to begin setting it up) and the relevent port(s) open. But if the security group and routing is setup correctly, and you have port 22 open, then you should definitely be able to SSH to Amazon Linux, the same as you can to Ubuntu.

    Just a thought, did you select "My IP" when setting up the security group for the instance? If it was limited to your IP then has that changed - depending on your ISP your Home IP address can change periodically, and obviously your IP is different at home/at work/on VPN/on cellular.

    If none of this helps then consider using Reachability Analyser https://docs.aws.amazon.com/vpc/latest/reachability/what-is-reachability-analyzer.html

1

I am going to give you a series of configurations that you can review to verify the connection:

  • When you launch the instance check that "Auto assign public IP" is enabled

  • Make sure you have assigned a key pair

  • That the instance is in a public subnet, this will allow it to connect to the internet

  • Use the correct users:

    • For ubuntu it is: ubuntu
    • For Amazon Linux it is: ec2-user

I hope I have been helpful

profile picture
EXPERT
answered 10 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