Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Assigning a floating IP to an instance

Your freshly made machine lives on your own private network, created by you, and is thus currently unreachable from the rest of the world. To enable outside access to the machine you would need to assign a floating IP address to it.

If this is the first time you use a floating IP, there are probably no IP allocated to your project. To allocate an IP to your project you could use the following command:

Code Block
eigilo@access:~$ openstack floating ip create ext-net
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2017-02-02T14:52:46Z                 |
| description         |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 172.16.1.61                          |
| floating_network_id | 22a507fa-ca51-4b57-bf84-784213917662 |
| headers             |                                      |
| id                  | 1a90e802-5bc4-4997-b255-b2c942cfaa94 |
| port_id             | None                                 |
| project_id          | 2a4b680765554d728aa2f4d8aadab653     |
| project_id          | 2a4b680765554d728aa2f4d8aadab653     |
| revision_number     | 1                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| updated_at          | 2017-02-02T14:52:46Z                 |
+---------------------+--------------------------------------+

To show the floating IP's belonging to your project you could list them like so:

Code Block
 eigilo@access:~$ openstack floating ip list
+------------------------+---------------------+------------------+-------------------------+
| ID                     | Floating IP Address | Fixed IP Address | Port                    |
+------------------------+---------------------+------------------+-------------------------+
| 1a90e802-5bc4-4997-b25 | 172.16.1.61         | None             | None                    |
| 5-b2c942cfaa94         |                     |                  |                         |
| 5736b7eb-7934-4629     | 172.16.1.44         | 10.14.1.105      | 635637c2-b1ca-4759      |
| -921c-8d9cbda9c0af     |                     |                  | -8c5b-e7711c667138      |
+------------------------+---------------------+------------------+-------------------------+

To assign a floating IP to a virtual machine, you would use the following command:

Code Block
eigilo@access:~$ openstack server add floating ip MySecondServer 172.16.1.61

At this point you should be able to ping the server:

Code Block
eigilo@access:~$ ping 172.16.1.61
PING 172.16.1.61 (172.16.1.61) 56(84) bytes of data.
64 bytes from 172.16.1.61: icmp_seq=1 ttl=62 time=3.23 ms
64 bytes from 172.16.1.61: icmp_seq=2 ttl=62 time=1.03 ms
^C
--- 172.16.1.61 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 1.032/2.135/3.238/1.103 ms

And you should be able to log into it, using the private part of the key selected when the server were booted:

Code Block
eigilo@access:~$ ssh debian@172.16.1.61 -i .ssh/id_rsa
The authenticity of host '172.16.1.61 (172.16.1.61)' can't be established.
ECDSA key fingerprint is SHA256:PIR85mFU0TiOZ0mXHz1ExMvds1D1YO1eF+/TTniAYfo.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.16.1.61' (ECDSA) to the list of known hosts.
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
debian@mysecondserver:~$