skip to Main Content

I’ve set up an EC2 instance where I need to run some software, flexlm, and be accessible through a public IP address. I’ve set up an elastic IP and things should be working.

However, whenever I ssh into the instance or connect to it through the AWS console, I have the private IP in the terminal as my userID (e.g.)

ec2-user@ip-<private-ip>$

When I run the software, which is a license checking software, it says I am running the software from the private IP and not the EIP I set up.

Maybe I am understanding private vs public IP wrong? When I ssh into my EC2 is it even possible to run things and have them be exposed through the public IP? When someone accesses the EIP is that just being routed to the private IP?

Some clarity on the difference between IPs would be useful as well as info on if I can run software and have it run from the private IP.

Update: Added more detail

2

Answers


  1. If you can access your EC2 instance from the internet, then it is working correctly. Any time you connect via SSH to your EC2 instance from the AWS console, it will always show you the private IP.

    The private IP is simply the IP address of your EC2 instance from within the network. The public IP is the translated address that the internet can use to send data to your instance. I think you may be confused about the concept of IP addresses. I would read this AWS Documentation.

    If you want to verify your flexlm ports are open to the internet, there are a few ways you can do this.

    • From within the machine netstat -ntlp / netstat -nulp will show all open TCP / UDP ports (and associated programs) respectively.
    • Check your EC2 instance’s inbound and outbound rules and make sure the required ports are open to the internet.
    Login or Signup to reply.
  2. Amazon EC2 instances do not actually know their Public IP address. All traffic arrives at their Private IP address.

    When the instance access the Internet, traffic flows through the Internet Gateway. At this time, the Internet Gateway performs a ‘reverse NAT’ and makes the traffic ‘appear’ to come from the Elastic IP address (or, if there is no EIP, then the random Public IP address assigned to the instance). Similarly, when traffic from the Internet is sent to the EIP, the Internet Gateway forwards it to the Private IP address of the instance.

    The instance itself, however, has no record of the Elastic IP address. The benefit of this is that the EIP can be instantly remapped to another Amazon EC2 instance (useful when doing failover) without changing any configuration on the instance itself.

    If your software product accesses the Internet to determine its Public IP address (eg going to https://icanhazip.com/), then it will see its correct Public IP address. However, if it looks on the instance, it will not find the Public IP address.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search