CentOS Stream 9
Sponsored Link

OpenStack Zed : Neutron OVN 設定 (Compute ノード)2022/11/10

 
OpenStack Network Service(Neutron)の設定です。
当例では以下のような環境を例に、Open Virtual Network (OVN) を利用した Neutron ネットワークを設定します。
------------+-----------------------------+-----------------------------+------------
            |                             |                             |
        eth0|10.0.0.30                eth0|10.0.0.50                eth0|10.0.0.51
+-----------+-----------+     +-----------+-----------+     +-----------+-----------+
|   [ dlp.srv.world ]   |     | [ network.srv.world ] |     |  [ node01.srv.world ] |
|     (Control Node)    |     |     (Network Node)    |     |     (Compute Node)    |
|                       |     |                       |     |                       |
|  MariaDB    RabbitMQ  |     |      Open vSwitch     |     |        Libvirt        |
|  Memcached  Nginx     |     |     Neutron Server    |     |      Nova Compute     |
|  Keystone   httpd     |     |      OVN-Northd       |     |      Open vSwitch     |
|  Glance     Nova API  |     |         Nginx         |     |   OVN Metadata Agent  |
|                       |     |                       |     |     OVN-Controller    |
+-----------------------+     +-----------------------+     +-----------------------+

[1] Compute ノードに必要なパッケージをインストールします。
# Zed, EPEL, CRB からインストール

[root@node01 ~]#
dnf --enablerepo=centos-openstack-zed,epel,crb -y install openstack-neutron openstack-neutron-ml2 openstack-neutron-ovn-metadata-agent ovn-2021-host
[2] Compute ノードの Neutron サービスの設定です。
[root@node01 ~]#
mv /etc/neutron/neutron.conf /etc/neutron/neutron.conf.org

[root@node01 ~]#
vi /etc/neutron/neutron.conf
# 新規作成

[DEFAULT]
core_plugin = ml2
service_plugins = ovn-router
auth_strategy = keystone
state_path = /var/lib/neutron
allow_overlapping_ips = True
# RabbitMQ 接続情報
transport_url = rabbit://openstack:password@dlp.srv.world

# Keystone 認証情報
[keystone_authtoken]
www_authenticate_uri = https://dlp.srv.world:5000
auth_url = https://dlp.srv.world:5000
memcached_servers = dlp.srv.world:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = servicepassword
# httpd Keystone で自己署名の証明書を使用の場合は [true]
insecure = false

[oslo_concurrency]
lock_path = $state_path/lock

[root@node01 ~]#
chmod 640 /etc/neutron/neutron.conf

[root@node01 ~]#
chgrp neutron /etc/neutron/neutron.conf
[root@node01 ~]#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# 最終行に追記

[ml2]
type_drivers = flat,geneve
tenant_network_types = geneve
mechanism_drivers = ovn
extension_drivers = port_security
overlay_ip_version = 4

[ml2_type_geneve]
vni_ranges = 1:65536
max_header_size = 38

[ml2_type_flat]
flat_networks = *

[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver

[ovn]
# Network ノードの IP アドレス
ovn_nb_connection = tcp:10.0.0.50:6641
ovn_sb_connection = tcp:10.0.0.50:6642
ovn_l3_scheduler = leastloaded
ovn_metadata_enabled = True

[root@node01 ~]#
vi /etc/neutron/neutron_ovn_metadata_agent.ini
[DEFAULT]
# 2行目 : Nova API サーバーを追記
nova_metadata_host = dlp.srv.world
nova_metadata_protocol = https
# 任意のシークレットキーを指定
metadata_proxy_shared_secret = metadata_secret

# 最終行に追記
[agent]
root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf

[ovs]
ovsdb_connection = tcp:127.0.0.1:6640

[ovn]
# Network ノードの IP アドレス
ovn_sb_connection = tcp:10.0.0.50:6642

[root@node01 ~]#
vi /etc/sysconfig/openvswitch
# 28行目 : 追記

OPTIONS="
--ovsdb-server-options='--remote=ptcp:6640:127.0.0.1'
"
[root@node01 ~]#
vi /etc/nova/nova.conf
# [DEFAULT] セクション内の適当な場所へ追記

vif_plugging_is_fatal = True
vif_plugging_timeout = 300

# 最終行へ追記 : Neutron 認証情報
# [metadata_proxy_shared_secret] の値は [neutron_ovn_metadata_agent.ini] で指定した値
[neutron]
auth_url = https://dlp.srv.world:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = servicepassword
service_metadata_proxy = True
metadata_proxy_shared_secret = metadata_secret
insecure = false
[3] SELinux を有効にしている場合は、ポリシーの変更が必要です。
[root@node01 ~]#
dnf --enablerepo=centos-openstack-zed -y install openstack-selinux

[root@node01 ~]#
setsebool -P neutron_can_network on

[root@node01 ~]#
setsebool -P daemons_enable_cluster_mode on

[root@node01 ~]#
vi ovsofctl.te
# 以下の内容で新規作成

module ovsofctl 1.0;

require {
        type neutron_t;
        type neutron_exec_t;
        type neutron_t;
        type dnsmasq_t;
        type openvswitch_load_module_t;
        type tracefs_t;
        type var_run_t;
        type openvswitch_t;
        type ovsdb_port_t;
        class sock_file write;
        class file execute_no_trans;
        class dir search;
        class tcp_socket name_bind;
        class capability { dac_override sys_rawio };
}

#============= neutron_t ==============
allow neutron_t self:capability { dac_override sys_rawio };
allow neutron_t neutron_exec_t:file execute_no_trans;

#============= openvswitch_t ==============
allow openvswitch_t var_run_t:sock_file write;
allow openvswitch_t ovsdb_port_t:tcp_socket name_bind;

#============= openvswitch_load_module_t ==============
allow openvswitch_load_module_t tracefs_t:dir search;

#============= dnsmasq_t ==============
allow dnsmasq_t self:capability dac_override;

[root@node01 ~]#
checkmodule -m -M -o ovsofctl.mod ovsofctl.te

[root@node01 ~]#
semodule_package --outfile ovsofctl.pp --module ovsofctl.mod

[root@node01 ~]#
semodule -i ovsofctl.pp

[4] Neutron サービスを起動します。
[root@node01 ~]#
systemctl enable --now openvswitch ovn-controller

[root@node01 ~]#
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

[root@node01 ~]#
systemctl enable --now neutron-ovn-metadata-agent

[root@node01 ~]#
systemctl restart openstack-nova-compute
[root@node01 ~]#
ovs-vsctl set open . external-ids:ovn-remote=tcp:10.0.0.50:6642

[root@node01 ~]#
ovs-vsctl set open . external-ids:ovn-encap-type=geneve

[root@node01 ~]#
ovs-vsctl set open . external-ids:ovn-encap-ip=10.0.0.51

[5] Control ノードの Nova API サービスにも設定を追記して、Neutron サービスの状態を確認します。
[root@dlp ~(keystone)]#
vi /etc/nova/nova.conf
# 最終行へ追記:Neutron 認証情報
# [metadata_proxy_shared_secret] の値は [neutron_ovn_metadata_agent.ini] で指定した値
[neutron]
auth_url = https://dlp.srv.world:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = servicepassword
service_metadata_proxy = True
metadata_proxy_shared_secret = metadata_secret
insecure = false

[root@dlp ~(keystone)]#
systemctl restart openstack-nova-api
# Network Agent 確認 (以下のように表示されれば OK)

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

+--------------------------------------+----------------------+------------------+-------------------+-------+-------+----------------------------+
| ID                                   | Agent Type           | Host             | Availability Zone | Alive | State | Binary                     |
+--------------------------------------+----------------------+------------------+-------------------+-------+-------+----------------------------+
| e1d9d28e-d83a-41f6-a0e4-15963930e733 | OVN Controller agent | node01.srv.world |                   | :-)   | UP    | ovn-controller             |
| 949d9c06-1d01-51dd-af83-8d77e7bd7ae2 | OVN Metadata agent   | node01.srv.world |                   | :-)   | UP    | neutron-ovn-metadata-agent |
+--------------------------------------+----------------------+------------------+-------------------+-------+-------+----------------------------+
関連コンテンツ