OpenStack Newton : Neutron 設定#1 (Control ノード)2016/10/23 |
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 | fb1ebfb4fe2a4ef3918d02932f4de062 | | domain_id | default | | enabled | True | | id | 5c2cced54a8f4b97a67ab3a0d179f29a | | name | neutron | | password_expires_at | None | +---------------------+----------------------------------+ # 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 | adfce65636084d8e8f0331d2bbf6c327 | | name | neutron | | type | network | +-------------+----------------------------------+ # Keystone ホストを定義しておく [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 | b159a187c6ec4e51b76a1722c0f9d05a | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | adfce65636084d8e8f0331d2bbf6c327 | | 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 | 7299fb2f98964e69be0a6ea67f305f70 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | adfce65636084d8e8f0331d2bbf6c327 | | 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 | c920a3fafb954940807e68e1332d9498 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | adfce65636084d8e8f0331d2bbf6c327 | | 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 33 Server version: 10.1.17-MariaDB MariaDB Server Copyright (c) 2000, 2016, 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)]>
MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec) exit Bye |
[3] | Neutron Server のインストールです。 |
[root@dlp ~(keystone)]# yum --enablerepo=centos-openstack-newton,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 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 # 102行目:追記 ( tenant_network_types の値はブランクでOK (後ほど必要な時にセット) ) [ml2]
type_drivers = flat,vlan,gre,vxlan
tenant_network_types = mechanism_drivers = openvswitch,l2population extension_drivers = port_security # 235行目:コメント解除 & 追記 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
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 |
[5] | SELinux を有効にしている場合は、ポリシーの変更が必要です。 |
[root@dlp ~(keystone)]# setsebool -P neutron_can_network on
[root@dlp ~(keystone)]#
vi neutron_pol.te # 以下の内容で新規作成 module neutron_pol 1.0; require { type crontab_exec_t; type glance_api_exec_t; type NetworkManager_exec_t; type loadkeys_exec_t; type gpg_exec_t; type mysqld_exec_t; type glance_registry_exec_t; type fsadm_exec_t; type nova_exec_t; type httpd_config_t; type virtd_exec_t; type chfn_exec_t; type systemd_systemctl_exec_t; type login_exec_t; type kdumpctl_exec_t; type debuginfo_exec_t; type numad_exec_t; type policykit_auth_exec_t; type ssh_keygen_exec_t; type vlock_exec_t; type ssh_exec_t; type dmesg_exec_t; type glance_scrubber_exec_t; type hostname_exec_t; type dbusd_exec_t; type plymouth_exec_t; type journalctl_exec_t; type fusermount_exec_t; type ping_exec_t; type gpg_agent_exec_t; type su_exec_t; type checkpolicy_exec_t; type sendmail_exec_t; type neutron_t; type systemd_tmpfiles_exec_t; type memcached_exec_t; type virsh_exec_t; type groupadd_exec_t; type systemd_passwd_agent_exec_t; type pinentry_exec_t; type passwd_exec_t; type systemd_notify_exec_t; type traceroute_exec_t; type mysqld_safe_exec_t; type ssh_agent_exec_t; type mandb_exec_t; type mount_exec_t; type rsync_exec_t; class dir search; class file getattr; } #============= neutron_t ============== allow neutron_t NetworkManager_exec_t:file getattr; allow neutron_t checkpolicy_exec_t:file getattr; allow neutron_t chfn_exec_t:file getattr; allow neutron_t crontab_exec_t:file getattr; allow neutron_t dbusd_exec_t:file getattr; allow neutron_t debuginfo_exec_t:file getattr; allow neutron_t dmesg_exec_t:file getattr; allow neutron_t fsadm_exec_t:file getattr; allow neutron_t fusermount_exec_t:file getattr; allow neutron_t glance_api_exec_t:file getattr; allow neutron_t glance_registry_exec_t:file getattr; allow neutron_t glance_scrubber_exec_t:file getattr; allow neutron_t gpg_agent_exec_t:file getattr; allow neutron_t gpg_exec_t:file getattr; allow neutron_t groupadd_exec_t:file getattr; allow neutron_t hostname_exec_t:file getattr; allow neutron_t httpd_config_t:dir search; allow neutron_t journalctl_exec_t:file getattr; allow neutron_t kdumpctl_exec_t:file getattr; allow neutron_t loadkeys_exec_t:file getattr; allow neutron_t login_exec_t:file getattr; allow neutron_t mandb_exec_t:file getattr; allow neutron_t memcached_exec_t:file getattr; allow neutron_t mount_exec_t:file getattr; allow neutron_t mysqld_exec_t:file getattr; allow neutron_t mysqld_safe_exec_t:file getattr; allow neutron_t nova_exec_t:file getattr; allow neutron_t numad_exec_t:file getattr; allow neutron_t passwd_exec_t:file getattr; allow neutron_t pinentry_exec_t:file getattr; allow neutron_t ping_exec_t:file getattr; allow neutron_t plymouth_exec_t:file getattr; allow neutron_t policykit_auth_exec_t:file getattr; allow neutron_t rsync_exec_t:file getattr; allow neutron_t sendmail_exec_t:file getattr; allow neutron_t ssh_agent_exec_t:file getattr; allow neutron_t ssh_exec_t:file getattr; allow neutron_t ssh_keygen_exec_t:file getattr; allow neutron_t su_exec_t:file getattr; allow neutron_t systemd_notify_exec_t:file getattr; allow neutron_t systemd_passwd_agent_exec_t:file getattr; allow neutron_t systemd_systemctl_exec_t:file getattr; allow neutron_t systemd_tmpfiles_exec_t:file getattr; allow neutron_t traceroute_exec_t:file getattr; allow neutron_t virsh_exec_t:file getattr; allow neutron_t virtd_exec_t:file getattr; allow neutron_t vlock_exec_t:file getattr; checkmodule -m -M -o neutron_pol.mod neutron_pol.te checkmodule: loading policy configuration from neutron_pol.te checkmodule: policy configuration loaded checkmodule: writing binary representation (version 17) to neutron_pol.mod # 中間ファイルからモジュール生成 [root@dlp ~(keystone)]# semodule_package --outfile neutron_pol.pp --module neutron_pol.mod # モジュールインストール [root@dlp ~(keystone)]# semodule -i neutron_pol.pp |
[6] | Firewalld を有効にしている場合は、サービスポートの許可が必要です。 |
[root@dlp ~(keystone)]# firewall-cmd --add-port=9696/tcp --permanent success [root@dlp ~(keystone)]# firewall-cmd --reload success |
Sponsored Link |