How to change IP address after OpenStack installation via devstack

After you have installed Openstack via devstack, what if you need to change the IP address of OpenStack's controller/compute nodes for whatever reason?

OpenStack deployment via devstack is stateless or ephemeral by design. As such, all OpenStack configuration files and databases are re-generated from scratch every time you run Therefore, when the IP address of any OpenStack node changes, you just need to redefine HOST_IP/SERVICE_HOST environment variables in localrc. All relevant OpenStack configuration files will then automatically be re-generated by

In your OpenStack development environment, if the IP address of an OpenStack node changes often, it is useful to define HOST_IP environment variable in localrc as follows, instead of defining it statically (e.g.,

HOST_IP=`ifconfig eth0 | sed -ne 's/.*inet addr:\([^ ]*\).*/\1/p'`

One caveat: there is one more configuration file (besides localrc) that you need to manually update when the IP address of the controller node changes. generates a user-specific MySQL configuration file in ~/.my.cnf, and includes the IP address of MySQL server there. If the MySQL configuration file already exists, does not overwrite the file. Thus, you need to update the IP address manually, or comment out if-clause in, as follows.

#    if [[ ! -e $HOME/.my.cnf ]]; then
         cat <$HOME/.my.cnf
         chmod 0600 $HOME/.my.cnf
#     fi

Without this change, you may encounter a MySQL connection timeout error on OpenStack controller node while running, because it attempts to access MySQL server at an old IP address.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

2 thoughts on “How to change IP address after OpenStack installation via devstack

  1. I dont understand the reason for this. If you are going to re ./ everything, you are basically starting over. Why are you worried about changing IP? This doesn't preserve anything.

    If you can tell us how to do this by ./ that would be better since we could then move our server to a new IP while keeping everything functional, including all our VMs.

  2. Hey Dan.
    The if clause that you have mentioned in comment is not there in my file.
    I am using Ubuntu.
    Please help
    Thanx !

Leave a comment

Your email address will not be published. Required fields are marked *