Skip to main content

Changing the IP address of an OpenStack instance

Sometimes you can accidentally broke an instance and when you launch a new one to replace the old one, you want the new instance with the IP address that you had in the old instance.

The steps are very simple, first you have to remove the port that is associated with the instance. You can identify it by its current IP address:

$ sudo neutron port-list --fixed-ips ip_address=172.16.2.128
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
| id                                   | name | mac_address       | fixed_ips                                                                           |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
| aa2e65ec-bf1c-44c7-b38b-0b27fcc41d8f |      | fa:16:3e:05:f2:fe | {"subnet_id": "6be599d7-702f-4e54-b18d-3dfca1441617", "ip_address": "172.16.2.128"} |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+

With the instance stopped remove the port:

$sudo neutron port-delete aa2e65ec-bf1c-44c7-b38b-0b27fcc41d8f 
Deleted port: aa2e65ec-bf1c-44c7-b38b-0b27fcc41d8f

And now attach a new one with the desired IP address to your instance (c842228b-71e3-49d6-a5b5-33e6416e2669):

$ sudo nova interface-attach --fixed-ip 172.16.2.106 --net-id 26f6d6f9-0ff6-4825-99e8-35c3821f855f  c842228b-71e3-49d6-a5b5-33e6416e2669

That’s all, now you can start your instance with the new Ip address.

Verify error: Command ‘openssl’ returned non-zero exit status 4

After migrating the neutron-server and the keystone service from one machine to another I got the following error when running commands like neutron net-list:

2014-11-11 12:45:27.013 23123 WARNING keystoneclient.middleware.auth_token [-] Verify error: Command 'openssl' returned non-zero exit status 4
2014-11-11 12:45:27.013 23123 WARNING keystoneclient.middleware.auth_token [-] Authorization failed for token
2014-11-11 12:45:27.014 23123 INFO keystoneclient.middleware.auth_token [-] Invalid user token - rejecting request

 

To solve the error I had to remove the existing certificates:

rm /var/lib/neutron/keystone-signing/*

After that the certificates where generated again and the command was run succesfully.


Deprecated: Function create_function() is deprecated in /home/elkano.org/blog/wp-content/plugins/seo-ultimate/includes/jlfunctions/arr.php on line 64