OpenStackのNeutronでfloating IPを設定する例

内部Networkの192.168.50.100を外部ネットワークにマッピングする例を示します。

まず、内部ネット192.168.50.100のIPをもっているportのPORT_IDを調べます。
# neutron port-list
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------------+
| id                                   | name | mac_address       | fixed_ips                                                                             |
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------------+
| 02cd18bc-768b-4b9b-937b-40dfe66fe33e |      | fa:16:3e:41:3f:01 | {"subnet_id": "2cc97205-b498-4e53-8fe5-21dd6f5da317", "ip_address": "192.168.30.128"} |
| 897101af-581f-42da-b8b6-56b8352cf53f |      | fa:16:3e:b2:47:71 | {"subnet_id": "ad914263-519c-40eb-a9b4-421485e5ece3", "ip_address": "192.168.50.101"} |
| ace36996-0315-4a7d-8eaa-379bb67bd688 |      | fa:16:3e:95:40:18 | {"subnet_id": "ad914263-519c-40eb-a9b4-421485e5ece3", "ip_address": "192.168.50.100"} |
| bc538543-d817-48a9-9dd3-9803fe6cf058 |      | fa:16:3e:63:c9:12 | {"subnet_id": "ad914263-519c-40eb-a9b4-421485e5ece3", "ip_address": "192.168.50.1"}   |
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------------+
次で、以下のように実際にマッピングを作成します。
 # neutron floatingip-create --port-id ace36996-0315-4a7d-8eaa-379bb67bd688 --fixed-ip-address 192.168.50.100 ext-net
Created a new floatingip:
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| fixed_ip_address    | 192.168.50.100                       |
| floating_ip_address | 192.168.30.129                       |
| floating_network_id | 2635ab5a-0784-4898-b91d-dbe1228f31cf |
| id                  | ba6e13f3-0768-4d8f-8cd6-91217ea558aa |
| port_id             | ace36996-0315-4a7d-8eaa-379bb67bd688 |
| router_id           | 612dafe5-c553-4103-a5d2-96e379ed2e50 |
| tenant_id           | 4df9786b5d044f5e8ae1593e105546d4     |
+---------------------+--------------------------------------+

別の方法

なお、次のようにfloating IPを作成して、その後、associateすることもできる。
# neutron floatingip-create ext-net
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| fixed_ip_address    |                                      |
| floating_ip_address | 192.168.158.82                       |
| floating_network_id | 53fe6eb3-6558-47a5-a758-3b2aa1f102ce |
| id                  | b4cd47df-92e1-433d-b48f-152b79063984 |
| port_id             |                                      |
| router_id           |                                      |
| tenant_id           | c5f8ac76b2a541c09da7c0fa8f23c03f     |
+---------------------+--------------------------------------+
# neutron floatingip-associate b4cd47df-92e1-433d-b48f-152b79063984 ace36996-0315-4a7d-8eaa-379bb67bd688
上記こまんどの第二引数はfloatingipのID、第三引数はport_idを表す。

0 件のコメント: