Ask Your Question
0

How to find internal / private IP from within an instance?

asked 2016-07-04 01:52:02 -0500

OnePlusOneIsEleven gravatar image

I have a really simple problem, but I haven't been able to find the answer I need from neither the Docs nor Google in general.

What is OpenStack's equivalent of AWS' http://instance-data/latest/meta-data/local-ipv4 or GCE's http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip? I need an instance to be able to find its own internal / private IP address.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-07-05 22:50:04 -0500

james-denton gravatar image

In OpenStack, the metadata service can be reached from the instance at http://169.254.169.254/.

From within the instance, try the following:

$ curl http://169.254.169.254/latest/meta-data/local-ipv4

The fixed IP of the instance should be returned. There are some other attributes as well:

$ curl http://169.254.169.254/latest/meta-data/
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
hostname
instance-action
instance-id
instance-type
local-hostname
local-ipv4
placement/
public-hostname
public-ipv4
reservation-id

Hope that helps.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2016-07-04 01:52:02 -0500

Seen: 947 times

Last updated: Jul 05 '16