[关闭]
@zhangyy 2020-01-10T11:16:20.000000Z 字数 9255 阅读 127

Openstack 云计算(二): Openstack Rocky部署四 neutron 部署与验证 (控制节点)

openstack系列


  • 一:Neutron概述
  • 二:Neutron部署

一:Neutron概述

  1. OpenStack Networkingneutron),允许创建、插入接口设备,这些设备由其他的OpenStack服务管理。插件式的实现可以容纳不同的网络设备和软件,为OpenStack架构与部署提供了灵活性。
  2. 它包含下列组件:
  3. neutron-server
  4. 接收和路由API请求到合适的OpenStack网络插件,以达到预想的目的。
  5. OpenStack网络插件和代理
  6. 插拔端口,创建网络和子网,以及提供IP地址,这些插件和代理依赖于供应商和技术而不同,OpenStack网络基于插件和代理为Cisco 虚拟和物理交换机、NEC OpenFlow产品,Open vSwitch,Linux bridging以及VMware NSX 产品穿线搭桥。
  7. 常见的代理L3(3层),DHCP(动态主机IP地址),以及插件代理。
  8. 消息队列
  9. 大多数的OpenStack Networking安装都会用到,用于在neutron-server和各种各样的代理进程间路由信息。也为某些特定的插件扮演数据库的角色,以存储网络状态
  10. OpenStack网络主要和OpenStack计算交互,以提供网络连接到它的实例。

二:Neutron部署

2.1 neutron 数据库配置

  1. mysql -uroot -pflyfish225
  2. CREATE DATABASE neutron;
  3. GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'neutron';
  4. GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'neutron';
  5. flush privileges;

image_1d8ngtu0p10skufn5il1u0j5ls9.png-155.4kB

2.2 在keystone上创建neutron用户

  1. cd /openstack
  2. source keystone-admin-pass.sh
  3. openstack user create --domain default --password=neutron neutron
  4. openstack user list

image_1d8nh0b8c4f916l3jr41pfg1ib4m.png-127.2kB

2.3 将neutron添加到service项目并授予admin角色

  1. openstack role add --project service --user neutron admin
  2. 创建neutron服务实体
  3. openstack service create --name neutron --description "OpenStack Networking" network
  4. openstack service list

image_1d8nh42etnrv1ulp1chgf08b3m13.png-140.7kB

2.4 创建neutron网络服务的API端点(endpoint)

  1. openstack endpoint create --region RegionOne network public http://controller:9696
  2. openstack endpoint create --region RegionOne network internal http://controller:9696
  3. openstack endpoint create --region RegionOne network admin http://controller:9696
  4. openstack endpoint list

image_1d8nh6goeb0443o1rtb23fet21g.png-182.1kB

image_1d8nh72r010s31k4ugk01j3410tg1t.png-290.7kB

2.5 在控制节点安装neutron网络组件

  1. # 关于neutron的网络提供了两种方式:
  2. https://docs.openstack.org/neutron/rocky/install/controller-install-option1-rdo.html
  3. 以下为第一种Networking Option 1: Provider networks
  1. 安装neutron软件包
  2. yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -y

image_1d8nhmnt81jefumdk93146ins3a.png-274.3kB

image_1d8nhnrqi1dpcuu13u81frdv6h4n.png-225.5kB

  1. 配置/etc/neutron/neutron.conf
  2. openstack-config --set /etc/neutron/neutron.conf database connection mysql+pymysql://neutron:neutron@controller/neutron
  3. openstack-config --set /etc/neutron/neutron.conf DEFAULT core_plugin ml2
  4. openstack-config --set /etc/neutron/neutron.conf DEFAULT service_plugins
  5. openstack-config --set /etc/neutron/neutron.conf DEFAULT transport_url rabbit://openstack:openstack@controller
  6. openstack-config --set /etc/neutron/neutron.conf DEFAULT auth_strategy keystone
  7. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken www_authenticate_uri http://controller:5000
  8. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_url http://controller:5000
  9. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken memcached_servers controller:11211
  10. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_type password
  11. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_domain_name default
  12. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken user_domain_name default
  13. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_name service
  14. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken username neutron
  15. openstack-config --set /etc/neutron/neutron.conf keystone_authtoken password neutron
  16. openstack-config --set /etc/neutron/neutron.conf DEFAULT notify_nova_on_port_status_changes True
  17. openstack-config --set /etc/neutron/neutron.conf DEFAULT notify_nova_on_port_data_changes True
  18. openstack-config --set /etc/neutron/neutron.conf nova auth_url http://controller:5000
  19. openstack-config --set /etc/neutron/neutron.conf nova auth_type password
  20. openstack-config --set /etc/neutron/neutron.conf nova project_domain_name default
  21. openstack-config --set /etc/neutron/neutron.conf nova user_domain_name default
  22. openstack-config --set /etc/neutron/neutron.conf nova region_name RegionOne
  23. openstack-config --set /etc/neutron/neutron.conf nova project_name service
  24. openstack-config --set /etc/neutron/neutron.conf nova username nova
  25. openstack-config --set /etc/neutron/neutron.conf nova password nova
  26. openstack-config --set /etc/neutron/neutron.conf oslo_concurrency lock_path /var/lib/neutron/tmp

image_1d8nhpg3c1cfs1bce15vq7sp14se54.png-415kB

image_1d8nhq28s1jm81m1d1c561j9q10fi5h.png-164.2kB

  1. egrep -v '(^$|^#)' /etc/neutron/neutron.conf
  2. ----
  3. [DEFAULT]
  4. core_plugin = ml2
  5. service_plugins =
  6. transport_url = rabbit://openstack:openstack@controller
  7. auth_strategy = keystone
  8. notify_nova_on_port_status_changes = True
  9. notify_nova_on_port_data_changes = True
  10. [agent]
  11. [cors]
  12. [database]
  13. connection = mysql+pymysql://neutron:neutron@controller/neutron
  14. [keystone_authtoken]
  15. www_authenticate_uri = http://controller:5000
  16. auth_url = http://controller:5000
  17. memcached_servers = controller:11211
  18. auth_type = password
  19. project_domain_name = default
  20. user_domain_name = default
  21. project_name = service
  22. username = neutron
  23. password = neutron
  24. [matchmaker_redis]
  25. [nova]
  26. auth_url = http://controller:5000
  27. auth_type = password
  28. project_domain_name = default
  29. user_domain_name = default
  30. region_name = RegionOne
  31. project_name = service
  32. username = nova
  33. password = nova
  34. [oslo_concurrency]
  35. lock_path = /var/lib/neutron/tmp
  36. [oslo_messaging_amqp]
  37. [oslo_messaging_kafka]
  38. [oslo_messaging_notifications]
  39. [oslo_messaging_rabbit]
  40. [oslo_messaging_zmq]
  41. [oslo_middleware]
  42. [oslo_policy]
  43. [quotas]
  44. [ssl]
  45. ----

  1. 快速配置/etc/neutron/plugins/ml2/ml2_conf.ini
  2. ---
  3. openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers flat,vlan
  4. openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types
  5. openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers linuxbridge
  6. openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security
  7. openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_flat flat_networks provider
  8. openstack-config --set /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup enable_ipset True
  9. ---

image_1d8ni0bv5uni11u61oqk4f0b6b5u.png-141.8kB

  1. egrep -v '(^$|^#)' /etc/neutron/plugins/ml2/ml2_conf.ini
  2. [DEFAULT]
  3. [l2pop]
  4. [ml2]
  5. type_drivers = flat,vlan
  6. tenant_network_types =
  7. mechanism_drivers = linuxbridge
  8. extension_drivers = port_security
  9. [ml2_type_flat]
  10. flat_networks = provider
  11. [ml2_type_geneve]
  12. [ml2_type_gre]
  13. [ml2_type_vlan]
  14. [ml2_type_vxlan]
  15. [securitygroup]
  16. enable_ipset = True

  1. 快速配置/etc/neutron/plugins/ml2/linuxbridge_agent.ini
  2. openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini linux_bridge physical_interface_mappings provider:eno16777736
  3. openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan enable_vxlan False
  4. openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup enable_security_group True
  5. openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

image_1d8nigfcs1d0118q5vcp1ul839b7b.png-95.1kB

  1. 查看生效的配置
  2. egrep -v '(^$|^#)' /etc/neutron/plugins/ml2/linuxbridge_agent.ini
  3. ---
  4. [DEFAULT]
  5. [agent]
  6. [linux_bridge]
  7. physical_interface_mappings = provider:eno16777736
  8. [network_log]
  9. [securitygroup]
  10. enable_security_group = True
  11. firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
  12. [vxlan]
  13. enable_vxlan = False
  14. ---

  1. 以下参数在启动neutron-linuxbridge-agent.service的时候会自动设置为1
  2. vim /etc/sysctl.conf
  3. ---
  4. net.ipv4.ip_forward = 1
  5. net.ipv4.conf.default.rp_filter=0
  6. net.ipv4.conf.all.rp_filter=0
  7. net.bridge.bridge-nf-call-iptables=1
  8. net.bridge.bridge-nf-call-ip6tables=1
  9. ---
  10. modprobe br_netfilter
  11. lsmod |grep br_netfilter
  12. sysctl net.bridge.bridge-nf-call-iptables
  13. sysctl net.bridge.bridge-nf-call-ip6tables

image_1d8nk1nr08bi1gtnsi31851s8b7o.png-44.3kB

  1. 快速配置/etc/neutron/dhcp_agent.ini
  2. openstack-config --set /etc/neutron/dhcp_agent.ini DEFAULT interface_driver linuxbridge
  3. openstack-config --set /etc/neutron/dhcp_agent.ini DEFAULT dhcp_driver neutron.agent.linux.dhcp.Dnsmasq
  4. openstack-config --set /etc/neutron/dhcp_agent.ini DEFAULT enable_isolated_metadata True

image_1d8nk53m31a9vn05n941tm86ft85.png-80kB

  1. egrep -v '(^$|^#)' /etc/neutron/dhcp_agent.ini

image_1d8nk60ri1fvkom0qdte311n658i.png-48.3kB

  1. 快速配置/etc/neutron/metadata_agent.ini
  2. openstack-config --set /etc/neutron/metadata_agent.ini DEFAULT nova_metadata_host controller
  3. openstack-config --set /etc/neutron/metadata_agent.ini DEFAULT metadata_proxy_shared_secret neutron

image_1d8nksrl310021teb126v3bh1khl8v.png-96.3kB

  1. egrep -v '(^$|^#)' /etc/neutron/metadata_agent.ini
  2. ---
  3. [DEFAULT]
  4. nova_metadata_host = controller
  5. metadata_proxy_shared_secret = neutron
  6. [agent]
  7. [cache]
  8. ---
  9. metadata_proxy_shared_secret选项是元数据代理,需要设置一个合适的密码这里设置为neutron

image_1d8nl0e4oqdv1c6j1ie019sjqla9c.png-95.1kB


  1. 配置计算服务使用网络服务
  2. 快速配置/etc/nova/nova.conf,将neutron添加到计算节点中
  3. openstack-config --set /etc/nova/nova.conf neutron url http://controller:9696
  4. openstack-config --set /etc/nova/nova.conf neutron auth_url http://controller:5000
  5. openstack-config --set /etc/nova/nova.conf neutron auth_type password
  6. openstack-config --set /etc/nova/nova.conf neutron project_domain_name default
  7. openstack-config --set /etc/nova/nova.conf neutron user_domain_name default
  8. openstack-config --set /etc/nova/nova.conf neutron region_name RegionOne
  9. openstack-config --set /etc/nova/nova.conf neutron project_name service
  10. openstack-config --set /etc/nova/nova.conf neutron username neutron
  11. openstack-config --set /etc/nova/nova.conf neutron password neutron
  12. openstack-config --set /etc/nova/nova.conf neutron service_metadata_proxy true
  13. openstack-config --set /etc/nova/nova.conf neutron metadata_proxy_shared_secret neutron

image_1d8nl3i0u1rs4r7u12o8kep1rfb9p.png-194.8kB

  1. egrep -v '(^$|^#)' /etc/nova/nova.conf

image_1d8nl554ti7v10n6ella1kkka6.png-123.4kB

  1. 初始化安装网络插件
  2. # 创建网络插件的链接,初始化网络的脚本插件会用到/etc/neutron/plugin.ini,需要使用ML2的插件进行提供
  3. ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

image_1d8nl6q3pmeh1v9fql1shd195eaj.png-47.4kB

  1. 同步数据库
  2. su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \
  3. --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron

image_1d8nl8g5i1vcr1j4q14iv5os1ficb0.png-147.1kB

  1. 重启nova_api服务
  2. systemctl restart openstack-nova-api.service

image_1d8nlak5up351p8b1jm5f0ml64bg.png-24.5kB

2.6 启动neutron服务并设置开机启动

  1. # 需要启动4个服务
  2. systemctl start neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
  3. systemctl status neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
  4. systemctl enable neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
  5. systemctl list-unit-files |grep neutron* |grep enabled

image_1d8nlevqi1p4au62bhspo01595bt.png-361.1kB

image_1d8nlgpj2rk11nf211vghhb3f0ca.png-363kB


  1. 至此,控制端的neutron网络服务就安装完成,之后需要在计算节点安装网络服务组件,使计算节点可以连接到openstack集群
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注