Manage IP addresses Each instance can have a private, or fixed, IP address and a public, or floating, one. Private IP addresses are used for communication between instances, and public ones are used for communication with the outside world. When you launch an instance, it is automatically assigned a private IP address that stays the same until you explicitly terminate the instance. Rebooting an instance has no effect on the private IP address. A pool of floating IPs, configured by the cloud operator, is available in OpenStack Compute. You can allocate a certain number of these to a project: The maximum number of floating IP addresses per project is defined by the quota. You can add a floating IP address from this set to an instance of the project. Floating IP addresses can be dynamically disassociated and associated with other instances of the same project at any time. Before you can assign a floating IP address to an instance, you first must allocate floating IPs to a project. After floating IP addresses have been allocated to the current project, you can assign them to running instances. You can assign a floating IP address to one instance at a time.
List floating IP address information To list all floating IP addresses: $ nova floating-ip-bulk-list +------------+---------------+---------------+--------+-----------+ | project_id | address | instance_uuid | pool | interface | +------------+---------------+---------------+--------+-----------+ | None | 172.24.4.225 | None | public | eth0 | | None | 172.24.4.226 | None | public | eth0 | | None | 172.24.4.227 | None | public | eth0 | | None | 172.24.4.228 | None | public | eth0 | | None | 172.24.4.229 | None | public | eth0 | | None | 172.24.4.230 | None | public | eth0 | | None | 172.24.4.231 | None | public | eth0 | | None | 172.24.4.232 | None | public | eth0 | | None | 172.24.4.233 | None | public | eth0 | | None | 172.24.4.234 | None | public | eth0 | | None | 172.24.4.235 | None | public | eth0 | | None | 172.24.4.236 | None | public | eth0 | | None | 172.24.4.237 | None | public | eth0 | | None | 172.24.4.238 | None | public | eth0 | | None | 192.168.253.1 | None | test | eth0 | | None | 192.168.253.2 | None | test | eth0 | | None | 192.168.253.3 | None | test | eth0 | | None | 192.168.253.4 | None | test | eth0 | | None | 192.168.253.5 | None | test | eth0 | | None | 192.168.253.6 | None | test | eth0 | +------------+---------------+---------------+--------+-----------+ To list all pools that provide floating IP addresses: $ nova floating-ip-pool-list +--------+ | name | +--------+ | public | | test | +--------+
Assign floating IP addresses You can assign floating IP addresses to a project or an instance. Allocate a floating IP address to the current project. If more than one IP address pool is available, you can specify the pool from which to allocate the IP address. This example specifies the public pool: $ nova floating-ip-create public +--------------+-------------+----------+--------+ | Ip | Instance Id | Fixed Ip | Pool | +--------------+-------------+----------+--------+ | 172.24.4.225 | None | None | public | +--------------+-------------+----------+--------+ To release a floating IP address from the current project: $ nova floating-ip-delete FLOATING_IP The IP address is returned to the pool of IP addresses that are available for all projects. If an IP address is assigned to a running instance, it is disassociated from the instance. To associate an IP address with an instance, at least one floating IP address must be allocated to the current project. To assign a floating IP address to an instance: $ nova add-floating-ip INSTANCE_NAME_OR_ID FLOATING_IP After you assign the IP address and configure security group rules for the instance, the instance is publicly available at the floating IP address. To remove a floating IP address from an instance, specify the same arguments that you used to assign the IP address: $ nova remove-floating-ip INSTANCE_NAME_OR_ID FLOATING_IP