A private or fixed IP is assigned to an instance based off the network specified on boot. However, the need may arise to re-assign this fixed IP in certain situations.
For example, consider a scenario where a fixed IP associated with an instance is hardcoded into or otherwise being referenced by your application, and the instance needs to be taken down for maintenance while maintaining minimal downtime for the application. Hence, another instance needs to be created to take its place with the same IP.
When such a scenario arises, it is required to re-assign the fixed IP of the instance which is undergoing maintenance to the replacement instance.
- Platform9 Managed OpenStack
- OpenStack CLI
For each step, run the provided command on the host for which you have the OpenStack CLI installed.
Remove the IP from the instance.
openstack server remove fixed ip <INSTANCE_ID> <IP>
Add a new IP to the instance.
openstack server add fixed ip --fixed-ip-address <IP> <INSTANCE_ID> <NETWORK_ID>
If the port is active, remove the IP from the instance with which the port is associated, or delete the instance altogether.
The following describes any known issues which may arise while performing this procedure and tips on how to resolve them.
--fixed-ip-address is not recognized
openstack server add fixed ip: error: unrecognized arguments: --fixed-ip-address
An older version of the OpenStack CLI is installed. An upgrade of the CLI package is necessary for this flag to be recognized. Refer to the OpenStack CLI section below for guidance on installing the latest CLI client.
Leveraging LBaaS (Load Balancer as a Service) is also an option which would allow you to maintain a static IP/endpoint for multiple instances.
A floating IP could be used for this purpose if utilizing an external network.
For more information on external networks, refer to Networking - Basic Concepts.
For guidance with installing the CLI client on your machine, refer to Installing PMO CLI Clients.
Was this article helpful?
Thank you for the feedback.