0

How to get the NAT ip address of an opnestack server instance, i am using the knife-openstack command to create the new instance and bootstrap it.

The reason is that some of the configuration require me to add the NAT ip address, using ohai i can get only the internal ip but not the public ip/NAT ip/ floating ip which openstack assigns on the runtime.

any help

Saurav
  • 414
  • 6
  • 17

2 Answers2

3

Here's what I do for HP's OpenStack (disclaimer: HP employee), although it requires the new hinting system in a release candidate version of the ohai gem. If you create a hint for openstack (i.e touch /etc/chef/ohai/hints/openstack.json) then it should work just as well.

$ sudo gem install ohai --version 6.18.0.rc.1
$ sudo mkdir -p /etc/chef/ohai/hints
$ sudo touch /etc/chef/ohai/hints/hp.json

$ sudo ohai
[lots deleted]
"cloud": {
  "public_ipv4": "15.185.XXX.XXX",
  "private_ips": [
    "10.4.XXX.XXX"
  ],
  "public_ips": [
    "15.185.XXX.XXX"
  ],
  "local_ipv4": "10.4.XX.XXX",
  "provider": "hp",
  "local_hostname": "precise",
  "public_hostname": "precise"
}

This is using this Chef Omnibus installer. If you're using the opscode Ubuntu packages then it could be a little more difficult to get going.

Tim Potter
  • 2,437
  • 21
  • 31
1

Have you created a public network in your environment? If you have done this, you need to create a router and then associate the public network with the internal network. After this, you can associate the floating ip with the internal ip. Finally, the instance contact with the Internet through the NAT method. you can check this blog. Wish this can help u.

lulyon
  • 6,707
  • 7
  • 32
  • 49
liuan
  • 299
  • 1
  • 3
  • 9