8.10.5. Associating the Floating IP Addresses

This procedure describes the procedure for associating floating point IP addresses.

Procedure 8.12. Associating the Floating IP Address using the Command Line Interface

  1. Retreive the pool id for the VM.
    After a VM is deployed a floating IP address can be associated to the VM. A VM that is created will be allocated an OpenStack Networking port ($PORT_ID).
    # nova list
    +--------------------------------------+--------+--------+---------------+
    |                  ID                  |  Name  | Status |    Networks   |
    +--------------------------------------+--------+--------+---------------+
    |              DEVICE_ID               | testvm | ACTIVE |    net1=IP    |
    +--------------------------------------+--------+--------+---------------+
    # neutron port-list -- --device_id DEVICE_ID
    +----------+--------+------------------+-----------------------------------------------+
    | ID | Name | MAC_Address      |                        Networks                       |
    +--------------------------------------+--------+--------+-----------------------------+
    | ID |      | fa:16:3e:b4:d6:6c| {"subnet_id": "SUBNET_ID", "ip_address": "IP_ADDRESS"}|
    +--------------------------------------+--------+--------+-----------------------------+
    
  2. Allocate a floating IP
    # neutron floatingip-create ext_net
    +---------------------+--------------------------------------+
    | Field               | Value                                |
    +---------------------+--------------------------------------+
    | fixed_ip_address    |                                      |
    | floating_ip_address | 7.7.7.131                            |
    | floating_network_id | 8858732b-0400-41f6-8e5c-25590e67ffeb |
    | id                  | 40952c83-2541-4d0c-b58e-812c835079a5 |
    | port_id             |                                      |
    | router_id           |                                      |
    | tenant_id           | e40fa60181524f9f9ee7aa1038748f08     |
    +---------------------+--------------------------------------+
  3. Associate a floating IP to a VM
    # neutron floatingip-associate FLOATING_ID PORT_ID
  4. Show the floating IP
    # neutron floatingip-show FLOATING_ID
    +---------------------+--------------------------------------+
    | Field               | Value                                |
    +---------------------+--------------------------------------+
    | fixed_ip_address    | 10.5.5.3                             |
    | floating_ip_address | 7.7.7.131                            |
    | floating_network_id | 8858732b-0400-41f6-8e5c-25590e67ffeb |
    | id                  | 40952c83-2541-4d0c-b58e-812c835079a5 |
    | port_id             | 9aa47099-b87b-488c-8c1d-32f993626a30 |
    | router_id           | 685f64e7-a020-4fdf-a8ad-e41194ae124b |
    | tenant_id           | e40fa60181524f9f9ee7aa1038748f08     |
    +---------------------+--------------------------------------+