{"id":1243,"date":"2016-03-07T20:26:40","date_gmt":"2016-03-07T19:26:40","guid":{"rendered":"https:\/\/elkano.org\/blog\/?p=1243"},"modified":"2016-03-07T17:31:30","modified_gmt":"2016-03-07T16:31:30","slug":"changing-ip-address-openstack-instance","status":"publish","type":"post","link":"https:\/\/elkano.org\/blog\/changing-ip-address-openstack-instance\/","title":{"rendered":"Changing the IP address of an OpenStack instance"},"content":{"rendered":"<p>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. <\/p>\n<p>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:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\n$ sudo neutron port-list --fixed-ips ip_address=172.16.2.128\r\n+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+\r\n| id                                   | name | mac_address       | fixed_ips                                                                           |\r\n+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+\r\n| aa2e65ec-bf1c-44c7-b38b-0b27fcc41d8f |      | fa:16:3e:05:f2:fe | {&quot;subnet_id&quot;: &quot;6be599d7-702f-4e54-b18d-3dfca1441617&quot;, &quot;ip_address&quot;: &quot;172.16.2.128&quot;} |\r\n+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+\r\n<\/pre>\n<p>With the instance stopped remove the port:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\n$sudo neutron port-delete aa2e65ec-bf1c-44c7-b38b-0b27fcc41d8f \r\nDeleted port: aa2e65ec-bf1c-44c7-b38b-0b27fcc41d8f\r\n<\/pre>\n<p>And now attach a new one with the desired IP address to your instance (c842228b-71e3-49d6-a5b5-33e6416e2669):<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\n$ sudo nova interface-attach --fixed-ip 172.16.2.106 --net-id 26f6d6f9-0ff6-4825-99e8-35c3821f855f  c842228b-71e3-49d6-a5b5-33e6416e2669\r\n<\/pre>\n<p>That&#8217;s all, now you can start your instance with the new Ip address.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[128],"tags":[174,173,132,149],"_links":{"self":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/1243"}],"collection":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/comments?post=1243"}],"version-history":[{"count":7,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/1243\/revisions"}],"predecessor-version":[{"id":1250,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/1243\/revisions\/1250"}],"wp:attachment":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/media?parent=1243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/categories?post=1243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/tags?post=1243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}