Atom feed of this document
  
 

 Manage IP addresses

Each instance can have a private, or fixed, IP address and an IP address, often public, that is movable from instance to instance called a floating IP address.

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 its private IP address.

The cloud operator must configure a pool of floating IP addresses. Then, you can allocate a certain number of floating IP addresses from this pool to a project. A project quota defines the maximum number of floating IP addresses for the project.

You can add a floating IP address from this pool to an instance in the project. You can dynamically associate floating IP addresses with or disassociate floating IP addresses from instances in the same project at any time.

Before you can assign a floating IP address to an instance, you must allocate floating IP addresses to a project. After you allocate floating IP addresses to the current project, you can assign them to running instances.

You can assign one floating IP address to only one instance at a time. Use the nova *floating-ip-* commands to manage floating IP addresses.

 

To manage floating IP addresses

  1. To list the floating IP address pools:

    $ nova floating-ip-pool-list
    +--------+
    | name   |
    +--------+
    | public |
    | test   |
    +--------+
    [Note]Note

    If this list is empty, the cloud operator must configure a pool of floating IP addresses.

  2. To allocate a floating IP address to the current project:

    $ nova floating-ip-create
    +--------------+-------------+----------+--------+
    | Ip           | Instance Id | Fixed Ip | Pool   |
    +--------------+-------------+----------+--------+
    | 172.24.4.226 | None        | None     | public |
    +--------------+-------------+----------+--------+

    By default, the floating IP address is allocated from the public pool. The command shows the allocated IP address.

    If more than one IP address pool is available, you can specify the pool from which to allocate the address:

    $ nova floating-ip-create POOL_NAME
  3. To list floating IP addresses that are allocated to the current project:

    $ nova floating-ip-list
    +--------------+--------------------------------------+----------+--------+
    | Ip           | Instance Id                          | Fixed Ip | Pool   |
    +--------------+--------------------------------------+----------+--------+
    | 172.24.4.225 | 4a60ff6a-7a3c-49d7-9515-86ae501044c6 | 10.0.0.2 | public |
    | 172.24.4.226 | None                                 | None     | public |
    +--------------+--------------------------------------+----------+--------+

    For each floating IP address that is allocated to the current project, the command shows the floating IP address, the ID for the instance to which the floating IP address is assigned, the associated fixed IP address, and the pool from which the floating IP address was allocated.

  4. To associate a floating IP address with an instance, first allocate that address to the current project:

    $ nova floating-ip-create
    +--------------+-------------+----------+--------+
    | Ip           | Instance Id | Fixed Ip | Pool   |
    +--------------+-------------+----------+--------+
    | 172.24.4.226 | None        | None     | public |
    +--------------+-------------+----------+--------+

    List instances to get the instance ID:

    $ nova list
    +--------------------------------------+-------------+--------+------------+-------------+--------------------------------+
    | ID                                   | Name        | Status | Task State | Power State | Networks                       |
    +--------------------------------------+-------------+--------+------------+-------------+--------------------------------+
    | 4a60ff6a-7a3c-49d7-9515-86ae501044c6 | my-instance | ACTIVE | None       | Running     | private=10.0.0.2, 172.24.4.225 |
    +--------------------------------------+-------------+--------+------------+-------------+--------------------------------+

    Then, assign the floating IP address to the instance, as follows:

    $ nova add-floating-ip my-instance 172.24.4.226

    Notice that the instance is now associated with two floating IP addresses:

    $ nova list
    +--------------------------------------+-------------+--------+------------+-------------+----------------------------------------------+
    | ID                                   | Name        | Status | Task State | Power State | Networks                                     |
    +--------------------------------------+-------------+--------+------------+-------------+----------------------------------------------+
    | 4a60ff6a-7a3c-49d7-9515-86ae501044c6 | my-instance | ACTIVE | None       | Running     | private=10.0.0.2, 172.24.4.225, 172.24.4.226 |
    +--------------------------------------+-------------+--------+------------+-------------+----------------------------------------------+

    To assign a fixed IP address to a floating IP address that you assign to an instance, add the fixed IP address as an optional parameter:

    $ nova add-floating-ip --fixed-address=FIXED_IP_ADDRESS INSTANCE_NAME_OR_ID FLOATING_IP_ADDRESS

    After you assign the floating IP address and configure security group rules for the instance, the instance is publicly available at the floating IP address.

  5. To release a floating IP address from the current project:

    $ nova floating-ip-delete FLOATING_IP_ADDRESS

    The floating IP address is returned to the floating IP address pool that is available to all projects. If a floating IP address is assigned to a running instance, it is automatically disassociated from that instance.

Questions? Discuss on ask.openstack.org
Found an error? Report a bug against this page

loading table of contents...