Neutron云计算网络虚拟化
- 格式:pdf
- 大小:7.56 MB
- 文档页数:35
描述neutron的基本架构,和基本工作流程。
Neutron是OpenStack的网络虚拟化组件,其主要功能是为OpenStack云平台中运行的虚拟机提供网络接口和网络连接。
Neutron的基本架构包括以下几个组件:
1. API服务器:提供API接口给用户或其他OpenStack组件使用,用于创建、管理和删除网络资源。
2. Plugin:管理和处理网络资源的创建、配置和删除等操作。
Neutron支持多种插件类型,如L2插件用于管理二层网络、L3插件管理三层网络。
3. Agent:运行在物理主机或网络设备上,用于提供虚拟机的网络连接和服务。
基本工作流程如下:
1. 用户通过API向Neutron发送网络资源创建请求,比如创建一个虚拟网络。
2. Plugin收到请求后,创建并配置相应的虚拟网络资源,如子网、路由、防火墙等。
3. Agent监视虚拟机状态,并为虚拟机提供网络服务。
如果虚拟机需要接入到虚拟网络中,则Agent会为其分配一个IP地址,并将虚拟网卡附加到虚拟网络中。
4. 当虚拟机需要访问外部网络时,Neutron会将其请求发送给L3 Agent,并通过路由和防火墙策略进行处理。
5. 当不再需要网络资源时,用户可以通过API向Neutron发送请求进行删除,Neutron将调用Plugin进行删除操作,同时Agent会清理相关的网络连接和服务。
云计算管理平台之OpenStack⽹络服务neutron ⼀、简介 neutron的主要作⽤是在openstack中为启动虚拟机实例提供⽹络服务,对于neutron来讲,它可以提供两种类型的⽹络;第⼀种是provider network,这种⽹络就是我们常说的桥接⽹络,虚拟机内部⽹络通常是通过bridge的⽅式直接桥接到宿主机的某块物理⽹卡上,从⽽实现虚拟机可以正常的访问外部⽹络,同时虚拟机外部⽹络也可以访问虚拟机的内部⽹络;第⼆种是self-service networks,这种⽹络就是nat⽹络;nat⽹络的实现是通过在虚拟机和宿主机之间实现了虚拟路由器,在虚拟机内部可以是⼀个私有地址连接⾄虚拟路由器的⼀个接⼝上,⽽虚拟路由器的另外⼀端通过⽹桥桥接到宿主机的某⼀张物理⽹卡;所以nat⽹络很好的隐藏了虚拟机的地址,它能够实现虚拟机访问外部⽹络,⽽外⽹⽤户是不能够直接访问虚拟机的;但在openstack中,它能够实现虚拟机和外部的⽹络做⼀对⼀nat绑定,从⽽实现从虚拟机外部⽹络访问虚拟机; self-service network ⽰意图 提⽰:self-service network 和provide network最⼤的区别是⾃服务⽹络中有虚拟路由器;有路由器就意味着虚拟机要和外⽹通信,⽹络报⽂要⾛三层,⽽对于provide network 来讲,它的⽹络报⽂就可以直接⾛⼆层⽹络;所以在openstack上这两种类型的⽹络实现⽅式和对应的组件也有所不同; provide network 实现所需组件 Provider networks - Overview Provider networks 连接⽰意图 提⽰:桥接⽹络也叫共享⽹络,虚拟机实例⽹络是通过桥接的⽅式直接共享宿主机⽹络;虚拟机和宿主机通信,就类似宿主机同局域⽹的其他主机通信⼀样;所以虚拟机和宿主机通信报⽂都不会到三层,所以这⾥⾯就不涉及三层⽹络相关的操作和配置; self-service network实现所需组件 Self-service networks - Overview Self-service networks连接⽰意图 对⽐上⾯两种⽹络的实现所需组件,我们可以发现self-service network的实现要⽐provide network要多⼀个networking L3 Agent插件;这个插件⽤作实现3层⽹络功能,⽐如,提供或管理虚拟路由器;从上⾯的两种⽹络连接⽰意图也可以看出,self-service network是包含provide network,也就是说我们选择使⽤self-service network这种类型的⽹络结构,我们即可以创建⾃服务⽹络,也可以创建桥接⽹络;对于⾃服务⽹络来讲,我们在计算节点启动的虚拟机,虚拟机想要访问外部⽹络,它会通过计算节点的vxlan接⼝,这⾥的vxlan我们可以理解为在计算节点内部实现的虚拟交换机,各虚拟机实例通过连接不同的vni(⽹络标识符,类似vlan id⼀样)的vxlan来实现⽹络的隔离,同时vxlan这个虚拟接⼝通常是桥接在本地管理⽹络接⼝上,这个管理⽹络⼀般是不能够和外部⽹络通信;虚拟机访问外部⽹络,通过vxlan接⼝实现的vxlan隧道,这个隧道是⼀头是和计算节点的管理⽹络接⼝连接,⼀头是和控制节点的管理⽹络接⼝连接;虚拟机访问外部⽹络是通过vxlan隧道,再通过控制节点中的虚拟路由器,将请求通过路由规则,路由到控制节点能够上外⽹的接⼝上,然后发出去,从⽽实现虚拟机能够和外部⽹络进⾏交互;⽽对于外部⽹络要访问虚拟机,在openstack上是通过⼀对⼀nat绑定实现;也就说在控制节点能够上外⽹的接⼝上配置很多ip地址,这些IP地址都是可以正常访问外部⽹络的,在虚拟机访问外部⽹络时,在控制节点的虚拟机路由器上就固定的把计算节点的某个虚拟机的流量通过固定SNAT的⽅式进⾏数据发送,对于这个固定地址在控制节点上再做固定的DNAT,从⽽实现外部⽹络访问控制节点上的这个固定ip,通过DNAT规则把外部流量引⼊到虚拟机,从⽽实现外部⽹络和虚拟机通信; neutron⼯作流程 neutron服务主要由neutron-server、neutron agents、neutron plugins这三个组件组成,这三者都依赖消息队列服务;其中neutron server主要⽤来接收⽤户的请求,⽐如创建或管理⽹络;当neutron server接收到客户端(openstack其他服务,如nova,neutron专有客户端)请求后,它会把请求丢到消息队列中去,然后neutron agents负责从消息队列中取出客户端的请求,在本地完成⽹络创建或管理,并把对应的操作的结果写到neutron 数据库中进⾏保存;这⾥需要说明⼀点neutron agents是指很多agent,每个agent都负责完成⼀件事,⽐如DHCP agent负责分配ip地址,network manage agent负责管理⽹络;⽽对于neutron plugins 主要⽤来借助外部插件的⽅式提供某种服务;⽐如ML2 plugin ⽤来提供2层虚拟⽹络服务的;如果neutron agents在创建或管理⽹络需要⽤到某个插件服务时,它会把请求插件的消息丢到消息队列,然后neutron plugins 从消息队列取出消息,并响应请求,把结果丢到消息队列,同时也会写到数据库中; ⼆、neutron服务的安装、配置 1、准备neutron 数据库、⽤户以及授权⽤户对neutron数据库下的所有表有所有权限;[root@node02 ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 184Server version: 10.1.20-MariaDB MariaDB ServerCopyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> CREATE DATABASE neutron;Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'neutron';Query OK, 0 rows affected (0.01 sec)MariaDB [(none)]> flush privileges;Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> 验证:⽤其他主机⽤neutron⽤户,看看是否可以正常连接数据库?[root@node01 ~]# mysql -uneutron -pneutron -hnode02Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 185Server version: 10.1.20-MariaDB MariaDB ServerCopyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> show databases;+--------------------+| Database |+--------------------+| information_schema || neutron || test |+--------------------+3 rows in set (0.00 sec)MariaDB [(none)]> 2、在控制节点安装配置neutron 导出admin环境变量,创建neutron⽤户,设置其密码为neutron[root@node01 ~]# source admin.sh[root@node01 ~]# openstack user create --domain default --password-prompt neutronUser Password:+---------------------+----------------------------------+| Field | Value |+---------------------+----------------------------------+| domain_id | 47c0915c914c49bb8670703e4315a80f || enabled | True || id | e7d0eae696914cc19fb8ebb24f4b5b0f || name | neutron || options | {} || password_expires_at | None |+---------------------+----------------------------------+[root@node01 ~]# 将neutron⽤户添加⾄service项⽬,并授权为admin⾓⾊[root@node01 ~]# openstack role add --project service --user neutron admin[root@node01 ~]# 创建neutron服务[root@node01 ~]# openstack service create --name neutron \> --description "OpenStack Networking" network+-------------+----------------------------------+| Field | Value |+-------------+----------------------------------+| description | OpenStack Networking || enabled | True || id | 3dc79e6a21e2484e8f92869e8745122c || name | neutron || type | network |+-------------+----------------------------------+[root@node01 ~]# 创建neutron服务端点(注册neutron服务) 公共端点[root@node01 ~]# openstack endpoint create --region RegionOne \> network public http://controller:9696+--------------+----------------------------------+| Field | Value |+--------------+----------------------------------+| enabled | True || id | 4a8c9c97417f4764a0e61b5a7a1f3a5f || interface | public || region | RegionOne || region_id | RegionOne || service_id | 3dc79e6a21e2484e8f92869e8745122c || service_name | neutron || service_type | network || url | http://controller:9696 |+--------------+----------------------------------+[root@node01 ~]# 私有端点[root@node01 ~]# openstack endpoint create --region RegionOne \> network internal http://controller:9696+--------------+----------------------------------+| Field | Value |+--------------+----------------------------------+| enabled | True || id | 1269653296e14406920bc43db65fd8af || interface | internal || region | RegionOne || region_id | RegionOne || service_id | 3dc79e6a21e2484e8f92869e8745122c || service_name | neutron || service_type | network || url | http://controller:9696 |+--------------+----------------------------------+[root@node01 ~]# 管理端点[root@node01 ~]# openstack endpoint create --region RegionOne \> network admin http://controller:9696+--------------+----------------------------------+| Field | Value |+--------------+----------------------------------+| enabled | True || id | 8bed1c51ed6d4f0185762edc2d5afd8a || interface | admin || region | RegionOne || region_id | RegionOne || service_id | 3dc79e6a21e2484e8f92869e8745122c || service_name | neutron || service_type | network || url | http://controller:9696 |+--------------+----------------------------------+[root@node01 ~]# 安装neutron服务组件包[root@node01 ~]# yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -y 编辑neutron服务的配置⽂件/etc/neutron/neutron.conf的【DEFAULT】配置段配置连接rabbitmq相关信息以及核⼼插件和⽹络插件等; 提⽰:我这⾥选择使⽤⾃服务⽹络类型;所以这⾥要配置service_plugins = router 并且启⽤叠加⽹络选项; 在【database】配置段配置连接neutron数据库相关信息 在【keystone_authtoken】配置段配置使⽤keystone做认证的相关信息 在【DEFAULT】配置段配置⽹络通知相关选项 在【nova】配置段配置nova服务相关信息 在【oslo_concurrency】配置段配置锁路径 neutron.conf的最终配置[root@node01 ~]# grep -i ^"[a-z\[]" /etc/neutron/neutron.conf[DEFAULT]transport_url = rabbit://openstack:openstack123@node02allow_overlapping_ips = trueauth_strategy = keystonenotify_nova_on_port_status_changes = truenotify_nova_on_port_data_changes = true[agent][cors][database]connection = mysql+pymysql://neutron:neutron@node02/neutron[keystone_authtoken]www_authenticate_uri = http://controller:5000auth_url = http://controller:5000memcached_servers = node02:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = neutronpassword = neutron[matchmaker_redis][nova]auth_url = http://controller:5000auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultregion_name = RegionOneproject_name = serviceusername = novapassword = nova[oslo_concurrency]lock_path = /var/lib/neutron/tmp[oslo_messaging_amqp][oslo_messaging_kafka][oslo_messaging_notifications][oslo_messaging_rabbit][oslo_messaging_zmq][oslo_middleware][oslo_policy][quotas][ssl][root@node01 ~]# 配置ML2插件 编辑配置⽂件/etc/neutron/plugins/ml2/ml2_conf.ini ,在【ml2】配置段配置⽀持flat(平⾯⽹络),vlan和vxlan 提⽰:配置ML2插件之后,删除type_drivers选项中的值可能会导致数据库不⼀致;意思是初始化数据库后,如果在删除上⾯的值,可能导致数据库不⼀致的情况; 在【ml2】配置段开启租户⽹络类型为vxlan 在【ml2】配置段启⽤Linux桥接和⼆层填充机制 在【ml2】配置段中启⽤端⼝安全扩展驱动程序 在【ml2_type_flat】配置段配置flat_networks = provider 提⽰:这⾥主要是指定平⾯⽹络的名称,就是虚拟机内部⽹络叫什么名,这个名称可以⾃定义,但后⾯会⽤到把该⽹络桥接到物理⽹卡中的配置,以及后续的创建⽹络都要⽤到这名称,请确保后续的名称和这⾥的名称保持⼀致; 在【ml2_type_vxlan】配置段中配置vxlan的标识范围 在【securitygroup】配置段启⽤ipset ml2_conf.ini的最终配置[root@node01 ~]# grep -i ^"[a-z\[]" /etc/neutron/plugins/ml2/ml2_conf.ini[DEFAULT][l2pop][ml2]type_drivers = flat,vlan,vxlantenant_network_types = vxlanmechanism_drivers = linuxbridge,l2populationextension_drivers = port_security[ml2_type_flat]flat_networks = provider[ml2_type_geneve][ml2_type_gre][ml2_type_vlan][ml2_type_vxlan]vni_ranges = 1:1000[securitygroup]enable_ipset = true[root@node01 ~]# 配置linux bridge agent 编辑/etc/neutron/plugins/ml2/linuxbridge_agent.ini,在【linux_bridge】配置段配置provider⽹络映射到物理的那个接⼝ 提⽰:这⾥主要是配置把把虚拟机内部的那个⽹络和物理接⼝的桥接映射,请确保虚拟机内部⽹络名称和这⾥配置的保持⼀致;冒号前指定虚拟机内部⽹络名称,冒号后⾯指定要桥接的物理⽹卡接⼝名称; 在【vxlan】配置段配置启⽤vxlan,并配置本地管理ip地址和开启l2_population 提⽰:local_ip写控制节点的管理ip地址(如果有多个ip地址的话); 在【securitygroup】配置段配置启⽤安全组并配置Linux bridge iptables防⽕墙驱动程序 linuxbridge_agent.ini的最终配置[root@node01 ~]# grep -i ^"[a-z\[]" /etc/neutron/plugins/ml2/linuxbridge_agent.ini[DEFAULT][agent][linux_bridge]physical_interface_mappings = provider:ens33[network_log][securitygroup]enable_security_group = truefirewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver[vxlan]l2_population = true[root@node01 ~]# 确定br_netfilter内核模块是加载启⽤,若没加载,加载内核模块并配置相关内核参数[root@node01 ~]# lsmod |grep br_netfilter[root@node01 ~]# modprobe br_netfilter[root@node01 ~]# lsmod |grep br_netfilterbr_netfilter 22209 0bridge 136173 1 br_netfilter[root@node01 ~]# 配置相关内核参数[root@node01 ~]# sysctl -pnet.bridge.bridge-nf-call-iptables = 1net.bridge.bridge-nf-call-ip6tables = 1[root@node01 ~]# 配置L3 agent 编辑/etc/neutron/l3_agent.ini配置⽂件,在【DEFAULT】配置段⽹络接⼝驱动为linuxbridge[DEFAULT]interface_driver = linuxbridge 配置DHCP agent 编辑/etc/neutron/dhcp_agent.ini配置⽂件,在【DEFAULT】配置段配置⽹络接⼝驱动为linuxbridge,启⽤元数据隔离,并配置dhcp驱动程序[DEFAULT]interface_driver = linuxbridgedhcp_driver = neutron.agent.linux.dhcp.Dnsmasqenable_isolated_metadata = true 配置metadata agent 编辑/etc/neutron/metadata_agent.ini配置⽂件,在【DEFAULT】配置段配置metadata server地址和共享密钥[DEFAULT]nova_metadata_host = controllermetadata_proxy_shared_secret = METADATA_SECRET 提⽰:metadata_proxy_shared_secret 这个是配置共享密钥的参数,后⾯的密钥可以随机⽣成,也可以设定任意字符串; 配置nova服务使⽤neutron服务 编辑/etc/nova/nova.conf配置⽂件,在【neutron】配置段配置neutron相关信息[neutron]url = http://controller:9696auth_url = http://controller:5000auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultregion_name = RegionOneproject_name = serviceusername = neutronpassword = neutronservice_metadata_proxy = truemetadata_proxy_shared_secret = METADATA_SECRET 提⽰:这⾥的metadata_proxy_shared_secret要和上⾯配置的metadata agent中配置的密钥保持⼀致即可; 将ml2的配置⽂件软连接到/etc/neutron/plugin.ini[root@node01 ~]# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini[root@node01 ~]# ll /etc/neutron/total 132drwxr-xr-x 11 root root 260 Oct 31 00:03 conf.d-rw-r----- 1 root neutron 10867 Oct 31 01:23 dhcp_agent.ini-rw-r----- 1 root neutron 14466 Oct 31 01:23 l3_agent.ini-rw-r----- 1 root neutron 11394 Oct 31 01:30 metadata_agent.ini-rw-r----- 1 root neutron 72285 Oct 31 00:25 neutron.conflrwxrwxrwx 1 root root 37 Oct 31 01:36 plugin.ini -> /etc/neutron/plugins/ml2/ml2_conf.inidrwxr-xr-x 3 root root 17 Oct 31 00:03 plugins-rw-r----- 1 root neutron 12689 Feb 28 2020 policy.json-rw-r--r-- 1 root root 1195 Feb 28 2020 rootwrap.conf[root@node01 ~]# 初始化neutron数据库[root@node01 ~]# 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" neutronINFO [alembic.runtime.migration] Context impl MySQLImpl.INFO [alembic.runtime.migration] Will assume non-transactional DDL.Running upgrade for neutron ...INFO [alembic.runtime.migration] Context impl MySQLImpl.INFO [alembic.runtime.migration] Will assume non-transactional DDL.INFO [alembic.runtime.migration] Running upgrade -> kiloINFO [alembic.runtime.migration] Running upgrade kilo -> 354db87e3225INFO [alembic.runtime.migration] Running upgrade 354db87e3225 -> 599c6a226151INFO [alembic.runtime.migration] Running upgrade 599c6a226151 -> 52c5312f6bafINFO [alembic.runtime.migration] Running upgrade 52c5312f6baf -> 313373c0ffeeINFO [alembic.runtime.migration] Running upgrade 313373c0ffee -> 8675309a5c4fINFO [alembic.runtime.migration] Running upgrade 8675309a5c4f -> 45f955889773INFO [alembic.runtime.migration] Running upgrade 45f955889773 -> 26c371498592INFO [alembic.runtime.migration] Running upgrade 26c371498592 -> 1c844d1677f7INFO [alembic.runtime.migration] Running upgrade 1c844d1677f7 -> 1b4c6e320f79INFO [alembic.runtime.migration] Running upgrade 1b4c6e320f79 -> 48153cb5f051INFO [alembic.runtime.migration] Running upgrade 48153cb5f051 -> 9859ac9c136INFO [alembic.runtime.migration] Running upgrade 9859ac9c136 -> 34af2b5c5a59INFO [alembic.runtime.migration] Running upgrade 34af2b5c5a59 -> 59cb5b6cf4dINFO [alembic.runtime.migration] Running upgrade 59cb5b6cf4d -> 13cfb89f881aINFO [alembic.runtime.migration] Running upgrade 13cfb89f881a -> 32e5974ada25INFO [alembic.runtime.migration] Running upgrade 32e5974ada25 -> ec7fcfbf72eeINFO [alembic.runtime.migration] Running upgrade ec7fcfbf72ee -> dce3ec7a25c9INFO [alembic.runtime.migration] Running upgrade dce3ec7a25c9 -> c3a73f615e4INFO [alembic.runtime.migration] Running upgrade c3a73f615e4 -> 659bf3d90664INFO [alembic.runtime.migration] Running upgrade 659bf3d90664 -> 1df244e556f5INFO [alembic.runtime.migration] Running upgrade 19f26505c74f -> 15be73214821INFO [alembic.runtime.migration] Running upgrade 15be73214821 -> b4caf27aae4INFO [alembic.runtime.migration] Running upgrade b4caf27aae4 -> 15e43b934f81INFO [alembic.runtime.migration] Running upgrade 15e43b934f81 -> 31ed664953e6INFO [alembic.runtime.migration] Running upgrade 31ed664953e6 -> 2f9e956e7532INFO [alembic.runtime.migration] Running upgrade 2f9e956e7532 -> 3894bccad37fINFO [alembic.runtime.migration] Running upgrade 3894bccad37f -> 0e66c5227a8aINFO [alembic.runtime.migration] Running upgrade 0e66c5227a8a -> 45f8dd33480bINFO [alembic.runtime.migration] Running upgrade 45f8dd33480b -> 5abc0278ca73INFO [alembic.runtime.migration] Running upgrade 5abc0278ca73 -> d3435b514502INFO [alembic.runtime.migration] Running upgrade d3435b514502 -> 30107ab6a3eeINFO [alembic.runtime.migration] Running upgrade 30107ab6a3ee -> c415aab1c048INFO [alembic.runtime.migration] Running upgrade c415aab1c048 -> a963b38d82f4INFO [alembic.runtime.migration] Running upgrade kilo -> 30018084ec99INFO [alembic.runtime.migration] Running upgrade 30018084ec99 -> 4ffceebfadaINFO [alembic.runtime.migration] Running upgrade 4ffceebfada -> 5498d17be016INFO [alembic.runtime.migration] Running upgrade 5498d17be016 -> 2a16083502f3INFO [alembic.runtime.migration] Running upgrade 2a16083502f3 -> 2e5352a0ad4dINFO [alembic.runtime.migration] Running upgrade 2e5352a0ad4d -> 11926bcfe72dINFO [alembic.runtime.migration] Running upgrade 11926bcfe72d -> 4af11ca47297INFO [alembic.runtime.migration] Running upgrade 4af11ca47297 -> 1b294093239cINFO [alembic.runtime.migration] Running upgrade 1b294093239c -> 8a6d8bdae39INFO [alembic.runtime.migration] Running upgrade 8a6d8bdae39 -> 2b4c2465d44bINFO [alembic.runtime.migration] Running upgrade 2b4c2465d44b -> e3278ee65050INFO [alembic.runtime.migration] Running upgrade e3278ee65050 -> c6c112992c9INFO [alembic.runtime.migration] Running upgrade c6c112992c9 -> 5ffceebfadaINFO [alembic.runtime.migration] Running upgrade 5ffceebfada -> 4ffceebfcdcINFO [alembic.runtime.migration] Running upgrade 4ffceebfcdc -> 7bbb25278f53INFO [alembic.runtime.migration] Running upgrade 7bbb25278f53 -> 89ab9a816d70INFO [alembic.runtime.migration] Running upgrade 89ab9a816d70 -> c879c5e1ee90INFO [alembic.runtime.migration] Running upgrade c879c5e1ee90 -> 8fd3918ef6f4INFO [alembic.runtime.migration] Running upgrade 8fd3918ef6f4 -> 4bcd4df1f426INFO [alembic.runtime.migration] Running upgrade 4bcd4df1f426 -> b67e765a3524INFO [alembic.runtime.migration] Running upgrade a963b38d82f4 -> 3d0e74aa7d37INFO [alembic.runtime.migration] Running upgrade 3d0e74aa7d37 -> 030a959ceafaINFO [alembic.runtime.migration] Running upgrade 030a959ceafa -> a5648cfeeadfINFO [alembic.runtime.migration] Running upgrade a5648cfeeadf -> 0f5bef0f87d4INFO [alembic.runtime.migration] Running upgrade 0f5bef0f87d4 -> 67daae611b6eINFO [alembic.runtime.migration] Running upgrade 67daae611b6e -> 6b461a21bcfcINFO [alembic.runtime.migration] Running upgrade 6b461a21bcfc -> 5cd92597d11dINFO [alembic.runtime.migration] Running upgrade 5cd92597d11d -> 929c968efe70INFO [alembic.runtime.migration] Running upgrade 929c968efe70 -> a9c43481023cINFO [alembic.runtime.migration] Running upgrade a9c43481023c -> 804a3c76314cINFO [alembic.runtime.migration] Running upgrade 804a3c76314c -> 2b42d90729daINFO [alembic.runtime.migration] Running upgrade 2b42d90729da -> 62c781cb6192INFO [alembic.runtime.migration] Running upgrade 62c781cb6192 -> c8c222d42aa9INFO [alembic.runtime.migration] Running upgrade c8c222d42aa9 -> 349b6fd605a6INFO [alembic.runtime.migration] Running upgrade 349b6fd605a6 -> 7d32f979895fINFO [alembic.runtime.migration] Running upgrade 7d32f979895f -> 594422d373eeINFO [alembic.runtime.migration] Running upgrade 594422d373ee -> 61663558142cINFO [alembic.runtime.migration] Running upgrade 61663558142c -> 867d39095bf4, port forwarding INFO [alembic.runtime.migration] Running upgrade b67e765a3524 -> a84ccf28f06aINFO [alembic.runtime.migration] Running upgrade a84ccf28f06a -> 7d9d8eeec6adINFO [alembic.runtime.migration] Running upgrade 7d9d8eeec6ad -> a8b517cff8abINFO [alembic.runtime.migration] Running upgrade a8b517cff8ab -> 3b935b28e7a0INFO [alembic.runtime.migration] Running upgrade 3b935b28e7a0 -> b12a3ef66e62INFO [alembic.runtime.migration] Running upgrade b12a3ef66e62 -> 97c25b0d2353INFO [alembic.runtime.migration] Running upgrade 97c25b0d2353 -> 2e0d7a8a1586INFO [alembic.runtime.migration] Running upgrade 2e0d7a8a1586 -> 5c85685d616dOK[root@node01 ~]# 验证:连接neutron数据库中是否有表⽣成?MariaDB [(none)]> use neutronReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedMariaDB [neutron]> show tables;+-----------------------------------------+| Tables_in_neutron |+-----------------------------------------+| address_scopes || agents || alembic_version || allowedaddresspairs || arista_provisioned_nets || arista_provisioned_tenants || arista_provisioned_vms || auto_allocated_topologies || bgp_peers || bgp_speaker_dragent_bindings || bgp_speaker_network_bindings || bgp_speaker_peer_bindings || bgp_speakers || brocadenetworks || brocadeports || cisco_csr_identifier_map || cisco_hosting_devices || cisco_ml2_apic_contracts || cisco_ml2_apic_host_links || cisco_ml2_apic_names || cisco_ml2_n1kv_network_bindings || cisco_ml2_n1kv_network_profiles || cisco_ml2_n1kv_policy_profiles || cisco_ml2_n1kv_port_bindings || cisco_ml2_n1kv_profile_bindings || cisco_ml2_n1kv_vlan_allocations || cisco_ml2_n1kv_vxlan_allocations || cisco_ml2_nexus_nve || cisco_ml2_nexusport_bindings || cisco_port_mappings || cisco_router_mappings || consistencyhashes || default_security_group || dnsnameservers || dvr_host_macs || externalnetworks || extradhcpopts || firewall_policies || firewall_rules || firewalls || flavors || flavorserviceprofilebindings || floatingipdnses || floatingips || ha_router_agent_port_bindings || ha_router_networks || ha_router_vrid_allocations || healthmonitors || ipallocations || ipamallocationpools || ipamallocations || ipamsubnets || ipsec_site_connections || ipsecpeercidrs || ipsecpolicies || logs || lsn || lsn_port || maclearningstates || members || meteringlabelrules || meteringlabels || ml2_brocadenetworks || ml2_brocadeports || ml2_distributed_port_bindings || ml2_flat_allocations || ml2_geneve_allocations || ml2_geneve_endpoints || ml2_gre_allocations || ml2_gre_endpoints || ml2_nexus_vxlan_allocations || ml2_nexus_vxlan_mcast_groups || ml2_port_binding_levels || ml2_port_bindings || ml2_ucsm_port_profiles || ml2_vlan_allocations || ml2_vxlan_allocations || ml2_vxlan_endpoints || multi_provider_networks || networkconnections || networkdhcpagentbindings || networkdnsdomains || networkgatewaydevicereferences || networkgatewaydevices || networkgateways || networkqueuemappings || networkrbacs || networks || networksecuritybindings || networksegments || neutron_nsx_network_mappings || neutron_nsx_port_mappings || neutron_nsx_router_mappings || neutron_nsx_security_group_mappings | | nexthops || nsxv_edge_dhcp_static_bindings || nsxv_edge_vnic_bindings || nsxv_firewall_rule_bindings || nsxv_internal_edges || nsxv_internal_networks || nsxv_port_index_mappings || nsxv_port_vnic_mappings || nsxv_router_bindings || nsxv_router_ext_attributes || nsxv_rule_mappings || nsxv_security_group_section_mappings | | nsxv_spoofguard_policy_network_mappings | | nsxv_tz_network_bindings || nsxv_vdr_dhcp_bindings || nuage_net_partition_router_mapping || nuage_net_partitions || nuage_provider_net_bindings || nuage_subnet_l2dom_mapping || poolloadbalanceragentbindings || poolmonitorassociations || pools || poolstatisticss || portbindingports || portdataplanestatuses || portdnses || portforwardings || portqueuemappings || ports || portsecuritybindings || providerresourceassociations || provisioningblocks || qos_bandwidth_limit_rules || qos_dscp_marking_rules || qos_fip_policy_bindings || qos_minimum_bandwidth_rules || qos_network_policy_bindings || qos_policies || qos_policies_default || qos_port_policy_bindings || qospolicyrbacs || qosqueues || quotas || quotausages || reservations || resourcedeltas || router_extra_attributes || routerl3agentbindings || routerports || routerroutes || routerrules || routers || securitygroupportbindings || securitygrouprules || securitygroups || segmenthostmappings || serviceprofiles || sessionpersistences || standardattributes || subnet_service_types || subnetpoolprefixes || subnetpools || subnetroutes || subnets || subports || tags || trunks || tz_network_bindings || vcns_router_bindings || vips || vpnservices |+-----------------------------------------+167 rows in set (0.00 sec)MariaDB [neutron]>[root@node01 ~]# systemctl restart openstack-nova-api.service[root@node01 ~]# ss -tnlState Recv-Q Send-Q Local Address:Port Peer Address:PortLISTEN 0 128 *:9292 *:*LISTEN 0 128 *:22 *:*LISTEN 0 100 127.0.0.1:25 *:*LISTEN 0 100 *:6080 *:*LISTEN 0 128 *:8774 *:*LISTEN 0 128 *:8775 *:*LISTEN 0 128 *:9191 *:*LISTEN 0 128 :::80 :::*LISTEN 0 128 :::22 :::*LISTEN 0 100 ::1:25 :::*LISTEN 0 128 :::5000 :::*LISTEN 0 128 :::8778 :::*[root@node01 ~]# 提⽰:重启确保nova-api服务的8774和8775端⼝正常监听; 启动neutron相关服务,并将其设置为开机启动[root@node01 ~]# systemctl start neutron-server.service \> neutron-linuxbridge-agent.service neutron-dhcp-agent.service \> neutron-metadata-agent.service[root@node01 ~]# systemctl enable neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.serviceCreated symlink from /etc/systemd/system/multi-user.target.wants/neutron-server.service to /usr/lib/systemd/system/neutron-server.service.Created symlink from /etc/systemd/system/multi-user.target.wants/neutron-linuxbridge-agent.service to /usr/lib/systemd/system/neutron-linuxbridge-agent.service.Created symlink from /etc/systemd/system/multi-user.target.wants/neutron-dhcp-agent.service to /usr/lib/systemd/system/neutron-dhcp-agent.service.Created symlink from /etc/systemd/system/multi-user.target.wants/neutron-metadata-agent.service to /usr/lib/systemd/system/neutron-metadata-agent.service.[root@node01 ~]# ss -tnlState Recv-Q Send-Q Local Address:Port Peer Address:PortLISTEN 0 128 *:9292 *:*LISTEN 0 128 *:22 *:*LISTEN 0 100 127.0.0.1:25 *:*LISTEN 0 128 *:9696 *:*LISTEN 0 100 *:6080 *:*LISTEN 0 128 *:8774 *:*LISTEN 0 128 *:8775 *:*LISTEN 0 128 *:9191 *:*LISTEN 0 128 :::80 :::*LISTEN 0 128 :::22 :::*LISTEN 0 100 ::1:25 :::*LISTEN 0 128 :::5000 :::*LISTEN 0 128 :::8778 :::*[root@node01 ~]# 提⽰:请确保9696端⼝正常监听; 如果我们选⽤的是self-service network 我们还需要启动L3 agent 服务,并将其设置为开机启动[root@node01 ~]# systemctl start neutron-l3-agent.service[root@node01 ~]# systemctl enable neutron-l3-agent.serviceCreated symlink from /etc/systemd/system/multi-user.target.wants/neutron-l3-agent.service to /usr/lib/systemd/system/neutron-l3-agent.service.[root@node01 ~]# 到此控制节点的neutron服务就配置好了 3、在计算节点安装配置neutron服务 安装neutron相关服务包[root@node03 ~]# yum install openstack-neutron-linuxbridge ebtables ipset -y 编辑/etc/neutron/neutron.conf,在【DEFAULT】配置段配置连接rabbitmq相关信息,以及配置认证策略为keystone 在【keystone_authtoken】配置段配置keystone认证相关信息 在【oslo_concurrency】配置段配置锁路径 neutron.conf最终配置[root@node03 ~]# grep -i ^"[a-z\[]" /etc/neutron/neutron.conf[DEFAULT]transport_url = rabbit://openstack:openstack123@node02auth_strategy = keystone[agent][cors][database][keystone_authtoken]www_authenticate_uri = http://controller:5000auth_url = http://controller:5000memcached_servers = node02:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = neutronpassword = neutron[matchmaker_redis][nova][oslo_concurrency]lock_path = /var/lib/neutron/tmp[oslo_messaging_amqp][oslo_messaging_kafka][oslo_messaging_notifications][oslo_messaging_rabbit][oslo_messaging_zmq][oslo_middleware][oslo_policy][quotas][ssl][root@node03 ~]# 配置linux bridge agent 编辑/etc/neutron/plugins/ml2/linuxbridge_agent.ini配置⽂件,在【linux_bridge】配置段配置provider⽹络映射到物理的那个接⼝ 提⽰:这⾥冒号前边的是虚拟机内部⽹络名称,这个名称请确保和控制节点上配置的虚拟机内部⽹络名称相同;冒号后⾯的是配置要桥接的物理接⼝名称; 在【vxlan】配置段配置启⽤vxlan,并配置本地管理ip地址和开启l2_population 在【securitygroup】配置段配置启⽤安全组并配置Linux bridge iptables防⽕墙驱动程序。
openstack neutron原理OpenStack Neutron(先前称为Quantum)是OpenStack项目中的网络服务组件,为云平台提供了虚拟网络的创建、管理和操作能力。
它的原理如下:1. 架构:Neutron采用了插件化的架构,通过各种插件来支持不同的网络技术和设备。
它包括核心服务(Core Service)、插件(Plugin)和代理(Agent)三个主要组件。
2. 核心服务:核心服务包括了API服务和插件调度服务。
API 服务提供了外部接口,用于接收和转发网络操作请求,并通过RPC(远程过程调用)机制与其他服务通信。
插件调度服务用于协调插件的使用和调度,并提供统一的接口给API服务。
3. 插件:插件是Neutron的核心组件,它们负责提供具体的网络功能和技术支持。
常见的插件包括Open vSwitch插件、Linuxbridge插件和Cisco插件等。
插件通过API与核心服务通信,接收和处理网络请求。
4. 代理:代理是运行在网络节点上的实体,用于处理具体的网络功能和操作。
它们包括L3代理、DHCP代理和Metadata代理等。
L3代理提供路由功能,负责处理跨子网的数据包;DHCP代理提供DHCP服务,为虚拟机提供动态IP地址;Metadata代理负责处理云平台元数据的访问。
5. 虚拟网络:Neutron通过虚拟网络抽象,将底层物理网络转化为虚拟网络,并为租户提供独立的、可定制的网络环境。
虚拟网络包括了子网、路由和安全组等组件,通过插件和代理来实现不同技术的网络隔离和功能。
总体来说,Neutron的原理是通过插件化的架构,将底层物理网络转化为虚拟网络,并借助核心服务、插件和代理等组件,提供各种网络功能和技术支持,实现云平台的网络管理和操作能力。
云计算基础平台搭建与管理
OpenStack地网络建设者——
Neutron
Flat网络模式是比较简单地一种模式,主要用虚拟网桥(类似交换机)建立了虚拟机与物理网卡之间地联系,所有虚拟机地IP地址与物理机(外网网卡)地IP地址处于同一个网段。
因为虚拟机与物理机属于同一个网
段,因此虚拟机与物理机可以直接通信。
GRE(General Routing Encapsulation)是一种路由封装地网络模式。
此种网络模式采用路由转发地方式实现虚拟机与物理网卡地通信,因此虚拟机IP网段与物理网卡地网
段不能在同一个网段。
VLAN(Local Area work)本地局域网,即可
将虚拟机放入不同地VLAN当形成虚拟地局域网,只有同一个VLAN地虚拟机可以相互
访问。
ifconfig ens34 promisc
我们可以看到ens34这块网卡出现了PROMISC字样,这就成功设置了混杂模式,以后凡是通过该网卡地数据不论接收方是不是该网卡,均可以被该网卡接收。
2 3
9696
网。
云计算中的虚拟化技术云计算中的虚拟化技术一直以来都是一个非常重要的话题。
虚拟化技术使云计算能够更高效、更灵活地提供计算资源和服务,同时增强了系统的稳定性和安全性。
本文将详细介绍云计算中的虚拟化技术,在虚拟化技术的基础上,还会涵盖容器化技术和无服务器计算的概念。
一、虚拟化技术的基本概念虚拟化技术利用软件和硬件的组合,将物理资源抽象成虚拟资源,从而可以在物理资源的基础上创建多个虚拟机(VM)实例。
每个虚拟机实例都可以运行自己的操作系统(OS)和应用程序,就好像它们是真实的物理机一样。
在云计算中,虚拟化技术有以下几个核心概念:1.虚拟机(VM):虚拟机是在物理主机上创建的一个独立的虚拟计算环境,包括操作系统和应用程序等。
一个物理主机可以同时运行多个虚拟机实例,从而实现资源的共享和利用率的提高。
2. Hypervisor(也称为虚拟机管理器):Hypervisor是运行在物理主机上的软件,负责管理和控制虚拟机的运行。
它将物理主机的计算、存储和网络资源划分成多个虚拟资源池,并为每个虚拟机实例提供隔离、安全、可靠的运行环境。
3.资源池:资源池是物理主机上的一组可供虚拟机实例使用的资源,包括计算、存储和网络等。
通过资源池的划分和管理,可以更好地满足不同虚拟机实例对资源的需求,并在资源利用率方面实现较好的平衡。
虚拟化技术的优势在于能够提高硬件资源的利用率、降低系统成本、提高系统的可靠性和可扩展性。
此外,虚拟化技术还可以实现对系统的快速部署和自动化管理,从而使系统更易于维护和扩展。
二、虚拟化技术的分类虚拟化技术在云计算中有多种实现方式,根据虚拟化的层次和对象的不同,可以将虚拟化技术分为以下几类:1. 服务器虚拟化:服务器虚拟化是最常见的虚拟化方式,它将物理服务器划分成多个虚拟机实例,并为每个虚拟机实例分配一定的计算、存储和网络资源。
常见的服务器虚拟化技术包括VMware、Xen和KVM等。
2.存储虚拟化:存储虚拟化将不同的存储设备组合在一起,并为虚拟机实例提供统一的存储接口。
【n eu tr on】n eu tro n的基本原理与代码实现前言本文旨在介绍ne ut ro n的基本原理与代码实现。
ne ut ro n是一种用于软件定义网络(S DN)的网络虚拟化组件。
它允许用户通过A PI创建、配置和管理虚拟网络,提供了高度可扩展和灵活的网络服务。
本文将从ne ut ro n的基本原理入手,介绍其核心组件、架构和工作流程。
随后,我们将深入探讨n eu tr on的代码实现,涉及关键模块、A PI、数据库和消息队列等方面。
1. neutron的基本原理1.1核心组件n e ut ro n的核心组件包括以下几个部分:1.1.1网络节点网络节点是实现虚拟网络服务的关键组件,它提供了网络功能的计算、转发和管理。
ne ut ro n可以支持多节点的分布式部署,以确保网络的高可用性和性能优化。
1.1.2路由器路由器在虚拟网络中扮演关键角色,负责处理不同子网之间的数据包转发。
n eu tr on通过路由器服务来实现这一功能,支持路由表、路由规则和网络地址转换(N A T)等特性。
1.1.3子网子网是网络划分的基本单位,用于给虚拟机实例分配I P地址。
n e ut ro n通过子网服务将具有相同网络地址的虚拟机实例放置在同一网络中,并提供网络隔离和安全性。
1.1.4网络网络是用户虚拟化环境中的逻辑概念,它是一组子网和路由器的集合。
n e ut ro n通过网络服务将虚拟机实例连接到指定的子网上,并提供网络间的通信支持。
1.1.5安全组安全组是网络访问控制的重要手段,允许管理员为虚拟机实例定义入站和出站规则。
n eut r on的安全组服务提供了基于I P、协议和端口的安全策略配置,确保网络的安全性和可靠性。
1.2架构设计n e ut ro n的架构设计采用了插件化的方式,允许用户根据自身需求选择不同的网络后端。
它由以下几个核心模块组成:1.2.1网络服务插件网络服务插件是n eut r on的关键组成部分,负责处理各种网络操作和策略配置。