CentOS 7
Sponsored Link

OpenStack Ocata : ネットワークを構成する
2017/02/27
 
仮想マシンインスタンスが利用するネットワークを構成します。
All in One 構成の Neutron サービス または ノード毎に分離設定した Neutron サービスを事前に構成済みであることが前提です。
当例では、以下のような All in One 構成の環境を前提に、シンプルな FLAT タイプのプロバイダーネットワークを構成します。 また、ノードはネットワークインターフェースを二つ持っているものとします。
                  eth0|10.0.0.30 
          +-----------+-----------+
          |    [ Control Node ]   |
          |                       |
          |  MariaDB    RabbitMQ  |
          |  Memcached  httpd     |eth1
          |  Keystone   Glance    +------
          |   Nova API,Compute    |
          |    Neutron Server     |
          |  L2,L3,Metadata Agent |
          +-----------------------+

[1] Neutron サービスに追加設定します。
# ブリッジ追加

[root@dlp ~(keystone)]#
ovs-vsctl add-br br-eth1

# 追加したブリッジのポートにeth1を追加

[root@dlp ~(keystone)]#
ovs-vsctl add-port br-eth1 eth1

[root@dlp ~(keystone)]#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# 166行目:追記

[ml2_type_flat]
flat_networks = physnet1
[root@dlp ~(keystone)]#
vi /etc/neutron/plugins/ml2/openvswitch_agent.ini
# 193行目:追記

[ovs]
bridge_mappings = physnet1:br-eth1
[root@dlp ~(keystone)]#
systemctl restart neutron-openvswitch-agent

[2] 仮想ネットワークを構成します。
[root@dlp ~(keystone)]#
projectID=`openstack project list | grep service | awk '{print $2}'`
# [sharednet1] という名称の仮想ネットワーク作成

[root@dlp ~(keystone)]#
openstack network create --project $projectID \
--share --provider-network-type flat --provider-physical-network physnet1 sharednet1

+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2017-03-04T10:18:02Z                 |
| description               |                                      |
| dns_domain                | None                                 |
| id                        | 64119666-f6be-4043-9aa4-7f02fef52d6c |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| is_default                | None                                 |
| mtu                       | 1500                                 |
| name                      | sharednet1                           |
| port_security_enabled     | True                                 |
| project_id                | 18ba3488fac4462dbdc5689109386c36     |
| provider:network_type     | flat                                 |
| provider:physical_network | physnet1                             |
| provider:segmentation_id  | None                                 |
| qos_policy_id             | None                                 |
| revision_number           | 3                                    |
| router:external           | Internal                             |
| segments                  | None                                 |
| shared                    | True                                 |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| updated_at                | 2017-03-04T10:18:02Z                 |
+---------------------------+--------------------------------------+

# sharednet1 に 10.0.0.0/24 のサブネット追加

[root@dlp ~(keystone)]#
openstack subnet create subnet1 --network sharednet1 \
--project $projectID --subnet-range 10.0.0.0/24 \
--allocation-pool start=10.0.0.200,end=10.0.0.254 \
--gateway 10.0.0.1 --dns-nameserver 10.0.0.10

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| allocation_pools  | 10.0.0.200-10.0.0.254                |
| cidr              | 10.0.0.0/24                          |
| created_at        | 2017-03-04T10:19:40Z                 |
| description       |                                      |
| dns_nameservers   | 10.0.0.10                            |
| enable_dhcp       | True                                 |
| gateway_ip        | 10.0.0.1                             |
| host_routes       |                                      |
| id                | 074e099f-43c8-485c-ad38-0800cdc99a8c |
| ip_version        | 4                                    |
| ipv6_address_mode | None                                 |
| ipv6_ra_mode      | None                                 |
| name              | subnet1                              |
| network_id        | 64119666-f6be-4043-9aa4-7f02fef52d6c |
| project_id        | 18ba3488fac4462dbdc5689109386c36     |
| revision_number   | 2                                    |
| segment_id        | None                                 |
| service_types     |                                      |
| subnetpool_id     | None                                 |
| updated_at        | 2017-03-04T10:19:40Z                 |
+-------------------+--------------------------------------+

# 設定確認

[root@dlp ~(keystone)]#
openstack network list

+--------------------------------------+------------+--------------------------------------+
| ID                                   | Name       | Subnets                              |
+--------------------------------------+------------+--------------------------------------+
| 64119666-f6be-4043-9aa4-7f02fef52d6c | sharednet1 | 074e099f-43c8-485c-ad38-0800cdc99a8c |
+--------------------------------------+------------+--------------------------------------+

[root@dlp ~(keystone)]#
openstack subnet list

+--------------------------------------+---------+--------------------------------------+-------------+
| ID                                   | Name    | Network                              | Subnet      |
+--------------------------------------+---------+--------------------------------------+-------------+
| 074e099f-43c8-485c-ad38-0800cdc99a8c | subnet1 | 64119666-f6be-4043-9aa4-7f02fef52d6c | 10.0.0.0/24 |
+--------------------------------------+---------+--------------------------------------+-------------+
 
Tweet