OpenStack Antelope : Neutron OVN 設定 (Network ノード)2023/04/17 |
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] |
こちらを参考に Control ノード の Keystone に Neutron
用のユーザー/エンドポイントやデータベース等々を登録しておきます。
リンク先では Neutron Server (API) を Control ノード にインストールする前提の例となっていますが、 当例では Neutron Server を Network ノード にインストールします。 よって、当例での Neutron のエンドポイントは [10.0.0.50] となります。 |
[2] | Network ノードに Neutron Server をインストールします。 |
[root@network ~]# dnf --enablerepo=centos-openstack-antelope,epel,crb -y install openstack-neutron openstack-neutron-ml2 ovn22.12-central nginx nginx-mod-stream
|
[3] | Neutron Server の設定です。 |
[root@network ~]# mv /etc/neutron/neutron.conf /etc/neutron/neutron.conf.org
[root@network ~]#
vi /etc/neutron/neutron.conf # 新規作成 [DEFAULT] bind_host = 127.0.0.1 bind_port = 9696 core_plugin = ml2 service_plugins = ovn-router auth_strategy = keystone state_path = /var/lib/neutron allow_overlapping_ips = True notify_nova_on_port_status_changes = True notify_nova_on_port_data_changes = 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 [database] connection = mysql+pymysql://neutron:password@dlp.srv.world/neutron_ml2 [nova] 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 = nova password = servicepassword # httpd Keystone で自己署名の証明書を使用の場合は [true] insecure = false [oslo_concurrency] lock_path = $state_path/tmp [oslo_policy] enforce_new_defaults = true
[root@network ~]#
chmod 640 /etc/neutron/neutron.conf [root@network ~]# chgrp neutron /etc/neutron/neutron.conf
[root@network ~]#
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@network ~]#
vi /etc/sysconfig/openvswitch # 28行目 : 追記 OPTIONS=" --ovsdb-server-options='--remote=ptcp:6640:127.0.0.1' "
|
[4] | ネットワークノード用の SSL/TLS 証明書を取得 または 自己署名の証明書を作成して、Nginx にプロキシの設定をします。 |
[root@network ~]# mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.org
[root@network ~]#
vi /etc/nginx/nginx.conf # 新規作成 user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; include /etc/nginx/conf.d/*.conf; } stream { upstream neutron-api { server 127.0.0.1:9696; } server { listen 10.0.0.50:9696 ssl; proxy_pass neutron-api; } ssl_certificate "/etc/letsencrypt/live/network.srv.world/fullchain.pem"; ssl_certificate_key "/etc/letsencrypt/live/network.srv.world/privkey.pem"; } |
[5] | SELinux を有効にしている場合は、ポリシーの変更が必要です。 |
[root@network ~]# dnf --enablerepo=centos-openstack-antelope -y install openstack-selinux [root@network ~]# setsebool -P neutron_can_network on [root@network ~]# setsebool -P haproxy_connect_any on [root@network ~]# setsebool -P daemons_enable_cluster_mode on
[root@network ~]#
vi ovsofctl.te # 以下の内容で新規作成 module ovsofctl 1.0; require { type neutron_t; type neutron_exec_t; type dnsmasq_t; type tracefs_t; type openvswitch_load_module_t; type var_run_t; type openvswitch_t; type ovsdb_port_t; type dmesg_exec_t; type ping_exec_t; type ssh_exec_t; type ssh_keygen_exec_t; type crontab_exec_t; type dbusd_exec_t; type thumb_exec_t; type systemd_notify_exec_t; type keepalived_exec_t; type lsmd_plugin_exec_t; type gpg_agent_exec_t; type hostname_exec_t; type passwd_exec_t; type systemd_tmpfiles_exec_t; type rpmdb_exec_t; type systemd_hwdb_exec_t; type virt_qemu_ga_exec_t; type journalctl_exec_t; type conmon_exec_t; type locate_exec_t; type traceroute_exec_t; type mount_exec_t; type lsmd_exec_t; type policykit_auth_exec_t; type vlock_exec_t; type chronyc_exec_t; type ssh_agent_exec_t; type su_exec_t; type loadkeys_exec_t; type mandb_exec_t; type systemd_passwd_agent_exec_t; type gpg_exec_t; type checkpolicy_exec_t; type systemd_systemctl_exec_t; type devicekit_exec_t; type plymouth_exec_t; type chfn_exec_t; type rsync_exec_t; type NetworkManager_exec_t; type container_runtime_exec_t; type groupadd_exec_t; type kdumpctl_exec_t; type login_exec_t; type fusermount_exec_t; type httpd_t; type tmpfs_t; class tcp_socket { name_bind name_connect }; class sock_file write; class file { create execute_no_trans getattr link open read unlink write }; class dir search; 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; 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 chronyc_exec_t:file getattr; allow neutron_t conmon_exec_t:file getattr; allow neutron_t container_runtime_exec_t:file getattr; allow neutron_t crontab_exec_t:file getattr; allow neutron_t dbusd_exec_t:file getattr; allow neutron_t devicekit_exec_t:file getattr; allow neutron_t dmesg_exec_t:file getattr; allow neutron_t fusermount_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 journalctl_exec_t:file getattr; allow neutron_t kdumpctl_exec_t:file getattr; allow neutron_t keepalived_exec_t:file getattr; allow neutron_t loadkeys_exec_t:file getattr; allow neutron_t locate_exec_t:file getattr; allow neutron_t login_exec_t:file getattr; allow neutron_t lsmd_exec_t:file getattr; allow neutron_t lsmd_plugin_exec_t:file getattr; allow neutron_t mandb_exec_t:file getattr; allow neutron_t mount_exec_t:file getattr; allow neutron_t passwd_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 rpmdb_exec_t:file getattr; allow neutron_t rsync_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_hwdb_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 thumb_exec_t:file getattr; allow neutron_t traceroute_exec_t:file getattr; allow neutron_t virt_qemu_ga_exec_t:file getattr; allow neutron_t vlock_exec_t:file getattr; allow neutron_t tmpfs_t:file { create getattr link open read unlink write }; #============= 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; checkmodule -m -M -o ovsofctl.mod ovsofctl.te [root@network ~]# semodule_package --outfile ovsofctl.pp --module ovsofctl.mod [root@network ~]# semodule -i ovsofctl.pp |
[6] | Firewalld を有効にしている場合は、サービスポートの許可が必要です。 |
[root@network ~]# firewall-cmd --add-port={9696/tcp,6641/tcp,6642/tcp} success [root@network ~]# firewall-cmd --runtime-to-permanent success |
[7] | Neutron サービスを起動します。 |
[root@network ~]#
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini [root@network ~]# su -s /bin/bash neutron -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head"
[root@network ~]#
[root@network ~]# systemctl enable --now ovn-northd [root@network ~]# ovn-nbctl set-connection ptcp:6641:10.0.0.50 -- set connection . inactivity_probe=60000 [root@network ~]# ovn-sbctl set-connection ptcp:6642:10.0.0.50 -- set connection . inactivity_probe=60000
systemctl enable --now neutron-server nginx
|
Sponsored Link |
|