Перед конфигурацией сервиса управления сетями OpenStack (neutron) вы должны создать базу данных, учетные записи сервиса и конечные точки API.
Для создания базы данных, выполните следующие шаги:
Используйте клиент баз данных для подключения к серверу БД под пользователем root
:
$ mysql -u root -p
Создайте базу данных neutron
:
MariaDB [(none)] CREATE DATABASE neutron;
Grant proper access to the neutron
database, replacing
NEUTRON_DBPASS
with a suitable password:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \
IDENTIFIED BY 'NEUTRON_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \
IDENTIFIED BY 'NEUTRON_DBPASS';
Закройте клиент баз данных.
Подставьте учетную запись admin
для получения доступа к инструкциям командной строки, доступным только администраторам:
$ . admin-openrc
Для создания служебных учётных данных, выполните следующие шаги:
Создайте пользователя neutron
:
$ 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 |
+---------------------+----------------------------------+
Добавьте admin
роль пользователю neutron
:
$ openstack role add --project service --user neutron admin
Примечание
Эта команда ничего не выводит.
Создайте запись о сервисе neutron
:
$ openstack service create --name neutron \
--description "OpenStack Networking" network
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Networking |
| enabled | True |
| id | f71529314dab4a4d8eca427e701d209e |
| name | neutron |
| type | network |
+-------------+----------------------------------+
Создайте конечные точки API для сервиса Сетей:
$ openstack endpoint create --region RegionOne \
network public http://controller: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://controller:9696 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne \
network internal http://controller: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://controller:9696 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne \
network admin http://controller: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://controller:9696 |
+--------------+----------------------------------+
You can deploy the Networking service using one of two architectures represented by options 1 and 2.
Option 1 deploys the simplest possible architecture that only supports
attaching instances to provider (external) networks. No self-service (private)
networks, routers, or floating IP addresses. Only the admin
or other
privileged user can manage provider networks.
Option 2 augments option 1 with layer-3 services that support attaching
instances to self-service networks. The demo
or other unprivileged
user can manage self-service networks including routers that provide
connectivity between self-service and provider networks. Additionally,
floating IP addresses provide connectivity to instances using self-service
networks from external networks such as the Internet.
Self-service networks typically use overlay networks. Overlay network protocols such as VXLAN include additional headers that increase overhead and decrease space available for the payload or user data. Without knowledge of the virtual network infrastructure, instances attempt to send packets using the default Ethernet maximum transmission unit (MTU) of 1500 bytes. The Networking service automatically provides the correct MTU value to instances via DHCP. However, some cloud images do not use DHCP or ignore the DHCP MTU option and require configuration using metadata or a script.
Примечание
Option 2 also supports attaching instances to provider networks.
Choose one of the following networking options to configure services specific to it. Afterwards, return here and proceed to Настройте агент метаданных.
The metadata agent provides configuration information such as credentials to instances.
Отредактируйте файл /etc/neutron/metadata_agent.ini
и выполните следующие действия:
In the [DEFAULT]
section, configure the metadata host and shared
secret:
[DEFAULT]
# ...
nova_metadata_ip = controller
metadata_proxy_shared_secret = METADATA_SECRET
Replace METADATA_SECRET
with a suitable secret for the metadata proxy.
Отредактируйте файл /etc/nova/nova.conf
и выполните следующие действия:
In the [neutron]
section, configure access parameters, enable the
metadata proxy, and configure the secret:
[neutron]
# ...
url = http://controller:9696
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = NEUTRON_PASS
service_metadata_proxy = true
metadata_proxy_shared_secret = METADATA_SECRET
Замените NEUTRON_PASS `` паролем, который вы выбрали для пользователя ``neutron
в идентификаторе.
Replace METADATA_SECRET
with the secret you chose for the metadata
proxy.
The Networking service initialization scripts expect a symbolic link
/etc/neutron/plugin.ini
pointing to the ML2 plug-in configuration
file, /etc/neutron/plugins/ml2/ml2_conf.ini
. If this symbolic
link does not exist, create it using the following command:
# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
Заполните базу данных:
# 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
Примечание
Заполнение базы данных происходит позже для службы Сети, поскольку скрипт требует заполненных файлов настроек сервера и плагинов.
If you receive the following Python exception,
Could not parse rfc1738 URL from string
,
move the connection option from the [default]
section to the
[database]
section. Then, remove the single quotes from the
value in the neutron.conf
file.
Перезапустите API сервис вычислительных ресурсов:
# systemctl restart openstack-nova-api.service
Запустите сервисы службы Сети и настройте их автоматический запуск при загрузке системы.
Для обеих сетевых опций:
# systemctl enable neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service
# systemctl start neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service
For networking option 2, also enable and start the layer-3 service:
# systemctl enable neutron-l3-agent.service
# systemctl start neutron-l3-agent.service
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.