実験室で単一ノードOpenStack-ニュートラル(7)を構築する

9664 ワード

1.コントローラノード


1-1. データベース構築

#  mysql -u root -p
MariaDB [(none)] CREATE DATABASE neutron;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \
  IDENTIFIED BY 'NEUTRON_DB_비밀번호';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \
  IDENTIFIED BY 'NEUTRON_DB_비밀번호';

1-2. サービス証明書の作成

# . admin-openrc
# openstack user create --domain default --password-prompt neutron

User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | fdb0f541e28141719b6a43c8944bf1fb |
| name                | neutron                          |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

# openstack role add --project service --user neutron admin
# openstack service create --name neutron \
  --description "OpenStack Networking" network
  
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Networking             |
| enabled     | True                             |
| id          | f71529314dab4a4d8eca427e701d209e |
| name        | neutron                          |
| type        | network                          |
+-------------+----------------------------------+

# openstack endpoint create --region RegionOne \
  network public http://노드_IP_주소:9696

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 85d80a6d02fc4b7683f611d7fc1493a3 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | f71529314dab4a4d8eca427e701d209e |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://노드_IP_주소:9696          |
+--------------+----------------------------------+

# openstack endpoint create --region RegionOne \
  network internal http://노드_IP_주소:9696

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 09753b537ac74422a68d2d791cf3714f |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | f71529314dab4a4d8eca427e701d209e |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://노드_IP_주소:9696          |
+--------------+----------------------------------+

# openstack endpoint create --region RegionOne \
  network admin http://노드_IP_주소:9696

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 1ee14289c9374dffb5db92a5c112fc4e |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | f71529314dab4a4d8eca427e701d209e |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://노드_IP_주소:9696          |
+--------------+----------------------------------+

1-3. ネットワーク設定-セルフサービスネットワーク


ネットワークオプションには、Provider NetworksとSelf-ServiceNetworksが含まれます.本プロジェクトでは,シングルノードであるため,セルフサービスネットワークを用いてネットワーク設定を行う.

1-3-1. 構成部品の取り付け

# # apt install neutron-server neutron-plugin-ml2 \
  neutron-linuxbridge-agent neutron-l3-agent neutron-dhcp-agent \
  neutron-metadata-agent

1-3-2. サーバコンポーネントの構成

# vim /etc/neutron/neutron.conf
[database]
# ...
connection = mysql+pymysql://neutron:NEUTRON_DB_비밀번호PASS@localhost/neutron

[DEFAULT]
# ...
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = true

transport_url = rabbit://openstack:RabbitMQ_비밀번호@localhost

auth_strategy = keystone

notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true


[keystone_authtoken]
# ...
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = NEUTRON_PASS

[nova]
# ...
auth_url = http://localhost:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = NOVA_비밀번호

[oslo_concurrency]
# ...
lock_path = /var/lib/neutron/tmp

1-3-3. モジュール化第2層(ML 2)カードの構成

# vim /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
# ...
type_drivers = flat,vlan,vxlan
tenant_network_types = vxlan
mechanism_drivers = linuxbridge,l2population
extension_drivers = port_security

[ml2_type_flat]
# ...
flat_networks = provider
vni_ranges = 1:1000

[securitygroup]
# ...
enable_ipset = true

1-3-4.Linuxブリッジエージェント構成

# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:PROVIDER_INTERFACE_NAME

[vxlan]
enable_vxlan = true
local_ip = OVERLAY_INTERFACE_IP_ADDRESS
l2_population = true

[securitygroup]
# ...
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

1-3-5. カーネルパラメータ値の変更

# vim /etc/sysctl.conf 
# ...
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1

# sysctl -p 

1-3-6. Layer-3、DHCPエージェントの構成

# vim /etc/neutron/l3_agent.ini
[DEFAULT]
interface_driver = linuxbridge

# vim /etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true

1-4. Metadata Agentの構成

# vim /etc/neutron/metadata_agent.ini

[DEFAULT]
nova_metadata_host = localhost
metadata_proxy_shared_secret = METADATA_SECRET
METADATA SECRETは適切な秘密に変更されます.
Novaのインストール後
# vim /etc/nova/nova.conf

[neutron]
# ...
auth_url = http://localhost:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = NEUTRON_비밀번호
service_metadata_proxy = true
metadata_proxy_shared_secret = METADATA_SECRET
metadata proxy shared secret上に設定したsecretを入力します.

1-5. インストール完了

# su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \
  --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
# service nova-api restart
# service neutron-server restart
# service neutron-linuxbridge-agent restart
# service neutron-dhcp-agent restart
# service neutron-metadata-agent restart
# service neutron-l3-agent restart

2.コンピュータノード


本来は2つのノードを別々に設定するべきですが、1つのノードを使用するので、同じノードに設定すればいいのです.既に設定されていれば、確認しておけば大丈夫です.

2-1. コンポーネントのインストール

# apt install neutron-linuxbridge-agent

2-2. 共通コンポーネント構成

# vim /etc/neutron/neutron.conf
[DEFAULT]
# ...
transport_url = rabbit://openstack:RabbitMQ_비밀번호@localhost

auth_strategy = keystone

[keystone_authtoken]
# ...
www_authenticate_uri = http://localhost:5000
auth_url = http://localhost:5000
memcached_servers = localhost:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = NEUTRON_비밀번호

[oslo_concurrency]
# ...
lock_path = /var/lib/neutron/tmp

2-3. ネットワーク設定-セルフサービスネットワーク


2-3-1. Linuxブリッジエージェント構成

# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:PROVIDER_INTERFACE_NAME

[vxlan]
enable_vxlan = true
local_ip = OVERLAY_INTERFACE_IP_ADDRESS
l2_population = true

[securitygroup]
# ...
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

2-4. コンピューティング・サービスの構成

# vim /etc/nova/nova.conf
[neutron]
# ...
auth_url = http://localhost:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = NEUTRON_비밀번호

2-5. インストール完了

# service nova-compute restart
# service neutron-linuxbridge-agent restart