Neutron总结-为instance设置静态IP(OpenStack Mitaka版)

来源:互联网 发布:json.parse 解析出错 编辑:程序博客网 时间:2024/05/29 17:18

1.创建port

Mitaka 版 OpenStack 仅支持通过命令行操作为 instance 设置静态 IP。以下命令通过 admin 账户执行。因为操作的不是默认的 admin project,所以需要通过 –os-project-id 指定操作的项目ID。

[root@controller1 ~]# neutron --os-project-id 13f9b0dec6c64072825b343c3443fdac port-create --fixed-ip subnet_id=e8f05b2a-4b94-4b58-b441-a5d6656cfc20,ip_address=192.169.128.75 vlan11Created a new port:+-----------------------+------------------------------------------------------------------------------------+| Field                 | Value                                                                              |+-----------------------+------------------------------------------------------------------------------------+| admin_state_up        | True                                                                               || allowed_address_pairs |                                                                                    || binding:host_id       |                                                                                    || binding:profile       | {}                                                                                 || binding:vif_details   | {}                                                                                 || binding:vif_type      | unbound                                                                            || binding:vnic_type     | normal                                                                             || created_at            | 2017-09-14T06:38:25                                                                || description           |                                                                                    || device_id             |                                                                                    || device_owner          |                                                                                    || extra_dhcp_opts       |                                                                                    || fixed_ips             | {"subnet_id": "e8f05b2a-4b94-4b58-b441-a5d6656cfc20", "ip_address": "192.168.128.75"} || id                    | a7a4ec40-4497-4147-bed1-6a54d2ed1ed6                                               || mac_address           | fa:16:3e:78:7d:00                                                                  || name                  |                                                                                    || network_id            | 6319300e-75fe-44cd-ae5a-bc4472287f10                                               || port_security_enabled | True                                                                               || qos_policy_id         |                                                                                    || security_groups       | b110f339-2e4c-4ef0-be2f-6a5564604002                                               || status                | DOWN                                                                               || tenant_id             | 13f9b0dec6c64072825b343c3443fdac                                                   || updated_at            | 2017-09-14T06:38:25                                                                |+-----------------------+------------------------------------------------------------------------------------+

2.把port attach到instance

把刚创建的port attach到instance

[root@controller1 ~]# nova --os-project-id 13f9b0dec6c64072825b343c3443fdac interface-attach --port-id a7a4ec40-4497-4147-bed1-6a54d2ed1ed6 test-kvm

3.在instance中设置IP

进入instance,配置固定ip,重启网卡即可

原创粉丝点击