Manage Floating IP Addresses A floating IP address is an IP address (typically public) that can be dynamically assigned to an instance. Pools of floating IP addresses are created outside of python-novaclient with the nova-manage floating * commands. Refer to "Configuring Public (Floating) IP Addresses" in the OpenStack Compute Administration Manual for more information. Before you begin, use nova floating-ip-pool-list to determine what floating IP pools are available. $ nova floating-ip-pool-list +------+ | name | +------+ | nova | +------+ In this example, the only available pool is nova.
Reserve and associate floating IP addresses You can reserve floating IP addresses with the nova floating-ip-create command. This command reserves the addresses for the tenant, but does not immediately associate that address with an instance. $ nova floating-ip-create nova +--------------+-------------+----------+------+ | Ip | Instance Id | Fixed Ip | Pool | +--------------+-------------+----------+------+ | 50.56.12.232 | None | None | nova | +--------------+-------------+----------+------+ The floating IP address has been reserved, and can now be associated with an instance with the nova add-floating-ip command. For this example, we'll associate this IP address with an image called smallimage. $ nova add-floating-ip smallimage 50.56.12.232 After the command is complete, you can confirm that the IP address has been associated with the nova floating-ip-list and nova-list commands. $ nova floating-ip-list +--------------+--------------------------------------+------------+------+ | Ip | Instance Id | Fixed Ip | Pool | +--------------+--------------------------------------+------------+------+ | 50.56.12.232 | 542235df-8ba4-4d08-90c9-b79f5a77c04f | 10.4.113.9 | nova | +--------------+--------------------------------------+------------+------+ $ nova list +--------------------------------------+------------+--------+-------------------------------------------------------+ | ID | Name | Status | Networks | +--------------------------------------+------------+--------+-------------------------------------------------------+ | 4bb825ea-ea43-4771-a574-ca86ab429dcb | tinyimage2 | ACTIVE | public=10.4.113.6; private=172.16.101.6 | | 542235df-8ba4-4d08-90c9-b79f5a77c04f | smallimage | ACTIVE | public=10.4.113.9, 50.56.12.232; private=172.16.101.9 | +--------------------------------------+------------+--------+-------------------------------------------------------+ The first table shows that the 50.56.12.232 is now associated with the smallimage instance ID, and the second table shows the IP address included under smallimage's public IP addresses.
Remove and de-allocate a floating IP address To remove a floating IP address from an instance, use the nova remove-floating-ip command. $ nova remove-floating-ip smallimage 50.56.12.232 After the command is complete, you can confirm that the IP address has been associated with the nova floating-ip-list and nova-list commands. $ nova floating-ip-list +--------------+-------------+----------+------+ | Ip | Instance Id | Fixed Ip | Pool | +--------------+-------------+----------+------+ | 50.56.12.232 | None | None | nova | +--------------+-------------+----------+------+ $ nova list +--------------------------------------+------------+--------+-----------------------------------------+ | ID | Name | Status | Networks | +--------------------------------------+------------+--------+-----------------------------------------+ | 4bb825ea-ea43-4771-a574-ca86ab429dcb | tinyimage2 | ACTIVE | public=10.4.113.6; private=172.16.101.6 | | 542235df-8ba4-4d08-90c9-b79f5a77c04f | smallimage | ACTIVE | public=10.4.113.9; private=172.16.101.9 | +--------------------------------------+------------+--------+-----------------------------------------+ You can now de-allocate the floating IP address, returning it to the pool so that it can be used by another tenant. $ nova floating-ip-delete 50.56.12.232 In this example, 50.56.12.232 was the only IP address allocated to this tenant. Running nova floating-ip-list after the de-allocation is complete will return no results.