8.9.3. Adding Floating IP Addresses
This procedure details the definition of a pool of floating IP addresses. It also covers the reservation of a floating IP address from the pool and the association of that address with a specific Compute instance.
Procedure 8.7. Adding Floating IP Addresses using the Command Line Interface
- Use the
nova-manage floating createcommand to define a pool of floating IP addresses.$nova-manage floating create IP_BLOCKReplace IP_BLOCK with the block of IP addresses to use. This value is expressed using CIDR notation. - Use the
nova floating-ip-createcommand to reserve a floating IP address from the available blocks of public IP addresses.$nova floating-ip-create+--------------+-------------+----------+------+ | Ip | Instance Id | Fixed Ip | Pool | +--------------+-------------+----------+------+ | 172.31.0.225 | | | nova | +--------------+-------------+----------+------+ - Use the
nova listcommand to identify running instances and select an instance to assign the floating IP address to.$nova list+--------------------------------------+-------------------+--------+------------------+ | ID | Name | Status | Networks | +--------------------------------------+-------------------+--------+------------------+ | 0e4011a4-3128-4674-ab16-dd1b7ecc126e | rhel | ACTIVE | demonet=10.0.0.1 | +--------------------------------------+-------------------+--------+------------------+ - Use the
nova add-floating-ipcommand to assign the floating IP address that reserved in an earlier step to the selected instance.$nova add-floating-ip INSTANCE IPReplace INSTANCE with the identifier of the selected instance and replace IP with the floating IP address being assigned to it.Example 8.6. Assigning a Floating IP Address to an Instance
$nova add-floating-ip 0e4011a4-3128-4674-ab16-dd1b7ecc126e 172.31.0.225 - Periodically check the output of the
nova listcommand until the floating IP address appears in the output for the selected instance. Once this occurs the instance is accessible using the floating IP address.Note
To disassociate a floating IP address from an instance when it is no longer required, use thenova remove-floating-ipcommand.$nova remove-floating-ip INSTANCE IPReplace INSTANCE with the identifier of the instance and replace IP with the floating IP address to remove from it.
You have successfully associated a floating IP address with an instance using the command line interface.