CentOS 7
Sponsored Link

OpenStack Mitaka (三鷹) : Neutron 設定#1 (Control ノード)2016/04/28

 
OpenStack Network Service(Neutron)を設定します。
ここでは、以下のように、Keystone/Glance/Nova API インストール済みの Control ノード に 新たに Neutron Server をインストールし、 Network ノードに DHCP Agent, L3 Agent, L2 Agent, Metadata Agent、Nova Compute インストール済みの Compute ノードに L2 Agent という構成で設定します。 ( 例として役割ごとに分けていますが、All in One 構成にすることももちろん可能です )
なお、Neutron はプラグイン方式で、プラグインとして利用するソフトウェアを選択する必要があります。 ここでは例として ML2 プラグインを選択して設定します。( バックエンドは Open vSwitch を選択します )
                                |
+------------------+            |            +------------------------+
| [ Control Node ] |            |            |    [ Network Node ]    |
|     Keystone     |10.0.0.30   |   10.0.0.50|        DHCP Agent      |
|      Glance      |------------+------------|        L3 Agent        |
|     Nova API     |eth0        |        eth0|        L2 Agent        |
|  Neutron Server  |            |            |     Metadata Agent     |
+------------------+            |            +------------------------+
                            eth0|10.0.0.51
                      +--------------------+
                      |  [ Compute Node ]  |
                      |    Nova Compute    |
                      |      L2 Agent      |
                      +--------------------+

 
ここでは、Control ノードの設定をします。
[1] Control ノードの Keystone に Neutron 用のユーザー等々を登録しておきます。
# neutron ユーザー作成 (service プロジェクト所属)

[root@dlp ~(keystone)]#
openstack user create --domain default --project service --password servicepassword neutron

+--------------------+----------------------------------+
| Field              | Value                            |
+--------------------+----------------------------------+
| default_project_id | 0eb5f28ee57743c2a56c049caa97b7d2 |
| domain_id          | 25abd10294da4cb28aee485cd9587b87 |
| enabled            | True                             |
| id                 | 597ad07bd8cc4f37b0f12ce330264e87 |
| name               | neutron                          |
+--------------------+----------------------------------+

# neutron ユーザーを admin ロール に加える

[root@dlp ~(keystone)]#
openstack role add --project service --user neutron admin
# neutron 用サービスエントリ作成

[root@dlp ~(keystone)]#
openstack service create --name neutron --description "OpenStack Networking service" network

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Networking service     |
| enabled     | True                             |
| id          | 17ffb74056d44a2b925b75286cde686c |
| name        | neutron                          |
| type        | network                          |
+-------------+----------------------------------+

# 自ホストを定義しておく

[root@dlp ~(keystone)]#
export controller=10.0.0.30
# neutron 用エンドポイント作成 (public)

[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne network public http://$controller:9696

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 0b3f78de177b4ea291d3d992c8c917c7 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 17ffb74056d44a2b925b75286cde686c |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://10.0.0.30:9696            |
+--------------+----------------------------------+

# neutron 用エンドポイント作成 (internal)

[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne network internal http://$controller:9696

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | dbe485f4014340599af2bb8b66d8f3fe |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 17ffb74056d44a2b925b75286cde686c |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://10.0.0.30:9696            |
+--------------+----------------------------------+

# neutron 用エンドポイント作成 (admin)

[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne network admin http://$controller:9696

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 5bf5928e53604cb194e4e84cf5c85343 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 17ffb74056d44a2b925b75286cde686c |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://10.0.0.30:9696            |
+--------------+----------------------------------+
[2] Neutron 用のユーザーとデータベースを MariaDB に登録します。
[root@dlp ~(keystone)]#
mysql -u root -p

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 5.5.47-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>
create database neutron_ml2;

Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>
grant all privileges on neutron_ml2.* to neutron@'localhost' identified by 'password';

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
grant all privileges on neutron_ml2.* to neutron@'%' identified by 'password';

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
flush privileges;

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
exit

Bye
[3] Neutron Server のインストールです。
# Mitaka, EPEL からインストール

[root@dlp ~(keystone)]#
yum --enablerepo=centos-openstack-mitaka,epel -y install openstack-neutron openstack-neutron-ml2
[4] Neutron Server の設定です。
[root@dlp ~(keystone)]#
mv /etc/neutron/neutron.conf /etc/neutron/neutron.conf.org

[root@dlp ~(keystone)]#
vi /etc/neutron/neutron.conf
# 新規作成

[DEFAULT]
core_plugin = ml2
service_plugins = router
auth_strategy = keystone
state_path = /var/lib/neutron
dhcp_agent_notification = True
allow_overlapping_ips = True
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
rpc_backend = rabbit

[agent]
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf

# Keystone 認証情報
[keystone_authtoken]
auth_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = servicepassword

# MariaDB 接続情報
[database]
connection = mysql+pymysql://neutron:password@10.0.0.30/neutron_ml2

# Nova 接続情報
[nova]
auth_url = http://10.0.0.30:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = servicepassword

[oslo_concurrency]
lock_path = $state_path/lock

# RabbitMQ 接続情報
[oslo_messaging_rabbit]
rabbit_host = 10.0.0.30
rabbit_port = 5672
rabbit_userid = openstack
rabbit_password = password

[root@dlp ~(keystone)]#
chmod 640 /etc/neutron/neutron.conf

[root@dlp ~(keystone)]#
chgrp neutron /etc/neutron/neutron.conf

[root@dlp ~(keystone)]#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# 100行目:追記 ( tenant_network_types の値はブランクでOK (後ほど必要な時にセット) )

[ml2]
type_drivers = flat,vlan,gre,vxlan
tenant_network_types =
mechanism_drivers = openvswitch,l2population
extension_drivers = port_security
# 233行目:コメント解除 & 追記

enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
# 最終行:コメント解除

enable_ipset = True
[root@dlp ~(keystone)]#
vi /etc/nova/nova.conf
# [DEFAULT] セクション内の適当な場所へ追記

use_neutron = True
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver

# 最終行へ追記:Neutron 認証情報
[neutron]
url = http://10.0.0.30:9696
auth_url = http://10.0.0.30:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = servicepassword

[root@dlp ~(keystone)]#
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

[root@dlp ~(keystone)]#
su -s /bin/bash neutron -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head"

[root@dlp ~(keystone)]#
systemctl start neutron-server

[root@dlp ~(keystone)]#
systemctl enable neutron-server

[root@dlp ~(keystone)]#
systemctl restart openstack-nova-api

関連コンテンツ