Use IP address

fr_en

If you need to run a service or a server for your community, you can provision an IP address as decribed in  « IP provisionning ».

In this article, we describe how to associate an IP address to an already created instance. Note that it is no necessary to stop your instance to do so.

To illustrate our example, we will work with « myinstance » instance and « myport » port as shown below:

$>  openstack server list
+------------------------------+--------+--------+--------------+
| ID              | Name       | Status | Networks              |
+-----------------+------------+--------+-----------------------+
| aaa-bbb-ccc-ddd | myinstance | ACTIVE | public=134.158.74.999 |
+-----------------+------------+--------+-----------------------+
$>  openstack port list
+-----------------+--------+-------------------+----------------------------------------------+
| ID              | Name   | MAC Address       | Fixed IP Addresses                           |
+-----------------+--------+-------------------+----------------------------------------------+
| eee-fff-ggg-hhh | myport | fa:16:3e:07:85:da | ip_address='134.158.74.888', subnet_id='...' |
| iii-jjj-kkk-lll |        | 09:ee:54:a3:9f:10 | ip_address='134.158.74.999', subnet_id='...' |
+-----------------+--------+-------------------+----------------------------------------------+

The port list contains « myport » as well as the current port (« iii-jjj-kkk-lll »), automatically associated at « myinstance » creation.

We will remove the current port and associate « myport » to « myinstance ».

-1- delete current port

Delete the current port and check instance ports list. Note that current port has been removed and « myinstance » has no more IP address.

$>  openstack port delete iii-jjj-kkk-lll
$>  openstack port list
+-----------------+---------+-------------------+----------------------------------------------+
| ID              | Name    | MAC Address       | Fixed IP Addresses                           |
+-----------------+---------+-------------------+----------------------------------------------+
| eee-fff-ggg-hhh | myport  | fa:16:3e:07:85:da | ip_address='134.158.74.888', subnet_id='...' |
+-----------------+---------+-------------------+----------------------------------------------+
$>  openstack server list
+-----------------+------------+--------+----------+
| ID              | Name       | Status | NetWorks |
+-----------------+------------+--------+----------+
| aaa-bbb-ccc-ddd | myinstance | ACTIVE |          |
+-----------------+------------+--------+----------+

-2- associate your port

Associate « myport » to « myinstance » and check instance state. We can see that « myinstance » has  « myport » IP address.

$>  nova interface-attach --port-id xwservpub xwhep
$>  openstack server list
+-----------------+------------+--------+-----------------------+
| ID              | Name       | Status | Networks              |
+-----------------+------------+--------+-----------------------+
| aaa-bbb-ccc-ddd | myinstance | ACTIVE | public=134.158.74.888 |
+-----------------+------------+--------+-----------------------+

-3- restart instance.

Finally you must « materially » restart your instance.

$>  openstack server reboot --hard myinstance