Contents
- 1 1.网络服务概览
- 2 2.安装并配置控制节点
- 3 3.配置Neutron网络
- 4 4.安装和配置计算节点
- 5 5.验证操作
1.网络服务概览
OpenStack Networking(neutron),允许创建、插入接口设备,这些设备由其他的OpenStack服务管理。插件式的实现可以容纳不同的网络设备和软件,为OpenStack架构与部署提供了灵活性。
它包含下列组件:
- neutron-server
-
接收和路由API请求到合适的OpenStack网络插件,以达到预想的目的。
- OpenStack网络插件和代理
-
插拔端口,创建网络和子网,以及提供IP地址,这些插件和代理依赖于供应商和技术而不同,OpenStack网络基于插件和代理为Cisco 虚拟和物理交换机、NEC OpenFlow产品,Open vSwitch,Linux bridging以及VMware NSX 产品穿线搭桥。
常见的代理L3(3层),DHCP(动态主机IP地址),以及插件代理。
- 消息队列
-
大多数的OpenStack Networking安装都会用到,用于在neutron-server和各种各样的代理进程间路由信息。也为某些特定的插件扮演数据库的角色,以存储网络状态
OpenStack网络主要和OpenStack计算交互,以提供网络连接到它的实例。
1.1网络(neutron)概念
OpenStack网络(neutron)管理OpenStack环境中所有虚拟网络基础设施(VNI),物理网络基础设施(PNI)的接入层。OpenStack网络允许租户创建包括像 firewall, :term:`load balancer`和 :term:`virtual private network (VPN)`等这样的高级虚拟网络拓扑。
网络服务提供网络,子网以及路由这些对象的抽象概念。每个抽象概念都有自己的功能,可以模拟对应的物理设备:网络包括子网,路由在不同的子网和网络间进行路由转发。
对于任意一个给定的网络都必须包含至少一个外部网络。不像其他的网络那样,外部网络不仅仅是一个定义的虚拟网络。相反,它代表了一种OpenStack安装之外的能从物理的,外部的网络访问的视图。外部网络上的IP地址可供外部网络上的任意的物理设备所访问
外部网络之外,任何 Networking 设置拥有一个或多个内部网络。这些软件定义的网络直接连接到虚拟机。仅仅在给定网络上的虚拟机,或那些在通过接口连接到相近路由的子网上的虚拟机,能直接访问连接到那个网络上的虚拟机。
如果外部网络想要访问实例或者相反实例想要访问外部网络,那么网络之间的路由就是必要的了。每一个路由都配有一个网关用于连接到外部网络,以及一个或多个连接到内部网络的接口。就像一个物理路由一样,子网可以访问同一个路由上其他子网中的机器,并且机器也可以访问路由的网关访问外部网络。
另外,你可以将外部网络的IP地址分配给内部网络的端口。不管什么时候一旦有连接连接到子网,那个连接被称作端口。你可以给实例的端口分配外部网络的IP地址。通过这种方式,外部网络上的实体可以访问实例.
网络服务同样支持安全组。安全组允许管理员在安全组中定义防火墙规则。一个实例可以属于一个或多个安全组,网络为这个实例配置这些安全组中的规则,阻止或者开启端口,端口范围或者通信类型。
每一个Networking使用的插件都有其自有的概念。虽然对操作VNI和OpenStack环境不是至关重要的,但理解这些概念能帮助你设置Networking。所有的Networking安装使用了一个核心插件和一个安全组插件(或仅是空操作安全组插件)。另外,防火墙即服务(FWaaS)和负载均衡即服务(LBaaS)插件是可用的。
2.安装并配置控制节点
2.1先决条件
在你配置OpenStack网络(neutron)服务之前,你必须为其创建一个数据库,服务凭证和API端点。
2.1.1完成下面的步骤创建数据库
1.用数据库连接客户端以 root 用户连接到数据库服务器:
[root@controller ~]# mysql -uroot -p123456
2.创建“neutron
“ 数据库:
CREATE DATABASE neutron;
3.对“neutron“ 数据库授予合适的访问权限,使用合适的密码替换“NEUTRON_DBPASS“:
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \ IDENTIFIED BY 'NEUTRON_DBPASS'; GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \ IDENTIFIED BY 'NEUTRON_DBPASS';
4.退出数据库客户端。
2.1.2获得 admin 凭证来获取只有管理员能执行的命令的访问权限
[root@controller ~]# source admin-openrc
2.1.3创建服务证书,完成如下步骤
1.创建“neutron“用户:
[root@controller ~]# openstack user create --domain default --password NEUTRON_PASS neutron
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | 30c495cbb6e145cd9e70ffb825c0c710 |
| enabled | True |
| id | 2bd7222cd7a647bbbb1e699fba727be3 |
| name | neutron |
+-----------+----------------------------------+
2.添加“admin“ 角色到“neutron“ 用户
[root@controller ~]# openstack role add --project service --user neutron admin
3.创建“neutron“服务实体
[root@controller ~]# openstack service create --name neutron \ --description "OpenStack Networking" network +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Networking | | enabled | True | | id | c679e89f378e419d99ccffe32811013c | | name | neutron | | type | network | +-------------+----------------------------------+
2.1.4创建网络服务API端点
[root@controller ~]# openstack endpoint create --region RegionOne \ network public http://controller:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | f20f1956b1374e14bebc6c221d2ab890 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | c679e89f378e419d99ccffe32811013c | | service_name | neutron | | service_type | network | | url | http://controller:9696 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne \ network internal http://controller:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 7ce868a72b454e59819a57d0070df84c | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | c679e89f378e419d99ccffe32811013c | | service_name | neutron | | service_type | network | | url | http://controller:9696 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne \ network admin http://controller:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 8aed9445877547d5b732caea92e8dbfe | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | c679e89f378e419d99ccffe32811013c | | service_name | neutron | | service_type | network | | url | http://controller:9696 | +--------------+----------------------------------+
3.配置Neutron网络
根据使用场景的不同,网络配置分两种类型
1: Provider networks #这种最简单,下面的安装步骤就基于这种类型,桥接方式
2: Self-service networks
您可以部署网络服务使用选项1和选项2两种架构中的一种来部署网络服务。
选项1采用尽可能简单的架构进行部署,只支持实例连接到公有网络(外部网络)。没有私有网络(个人网络),路由器以及浮动IP地址。只有“admin“或者其他特权用户才可以管理公有网络
选项2在选项1的基础上多了layer-3服务,支持实例连接到私有网络。“demo“或者其他没有特权的用户可以管理自己的私有网络,包含连接公网和私网的路由器。另外,浮动IP地址可以让实例使用私有网络连接到外部网络,例如互联网
典型的私有网络一般使用覆盖网络。覆盖网络,例如VXLAN包含了额外的数据头,这些数据头增加了开销,减少了有效内容和用户数据的可用空间。在不了解虚拟网络架构的情况下,实例尝试用以太网 最大传输单元 (MTU) 1500字节发送数据包。网络服务会自动给实例提供正确的MTU的值通过DHCP的方式。但是,一些云镜像并没有使用DHCP或者忽视了DHCP MTU选项,要求使用元数据或者脚本来进行配置
3.1网络选项1:公共网络
3.1.1安装组件
[root@controller ~]# yum install openstack-neutron openstack-neutron-ml2 \ openstack-neutron-linuxbridge ebtables -y
3.1.2配置服务组件
Networking 服务器组件的配置包括数据库、认证机制、消息队列、拓扑变化通知和插件。
注释说明:
其中配置文件中的...表示默认文件内容
1.编辑“/etc/neutron/neutron.conf
“ 文件并完成如下操作
cp /etc/neutron/neutron.conf{,.bak} grep '^\[' /etc/neutron/neutron.conf.bak >/etc/neutron/neutron.conf vim /etc/neutron/neutron.conf
- 在
[database]
部分,配置数据库访问:
[database] ... connection = mysql+pymysql://neutron:NEUTRON_DBPASS@controller/neutron
使用你设置的数据库密码替换 NEUTRON_DBPASS 。
- 在“
[DEFAULT]
“部分,启用ML2插件并禁用其他插件
[DEFAULT] ... core_plugin = ml2 service_plugins =
- 在 “
[DEFAULT]
” 和 “[oslo_messaging_rabbit]
”部分,配置 “RabbitMQ” 消息队列的连接
[DEFAULT] ... rpc_backend = rabbit [oslo_messaging_rabbit] ... rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS
用你在RabbitMQ中为“openstack“选择的密码替换 “RABBIT_PASS”
- 在
“[DEFAULT]”
和“[keystone_authtoken]”
部分,配置认证服务访问:
[DEFAULT] ... auth_strategy = keystone [keystone_authtoken] ... auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = NEUTRON_PASS
将 NEUTRON_PASS 替换为你在认证服务中为 neutron 用户选择的密码。
- 在“
[DEFAULT]
“和“[nova]
“部分,配置网络服务来通知计算节点的网络拓扑变化:
[DEFAULT] ... notify_nova_on_port_status_changes = True notify_nova_on_port_data_changes = True [nova] ... auth_url = http://controller:35357 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = nova password = NOVA_PASS
使用你在身份认证服务中设置的“nova“ 用户的密码替换“NOVA_PASS“
- 在
[oslo_concurrency]
部分,配置锁路径:
[oslo_concurrency] ... lock_path = /var/lib/neutron/tmp
- MD5值及配置文件内容:
#MD5值 [root@controller ~]# md5sum /etc/neutron/neutron.conf 79e80bfccdee7e3403656a52c22cdf1d /etc/neutron/neutron.conf #配置文件内容 [root@controller ~]# cat /etc/neutron/neutron.conf [DEFAULT] core_plugin = ml2 service_plugins = rpc_backend = rabbit auth_strategy = keystone notify_nova_on_port_status_changes = True notify_nova_on_port_data_changes = True [agent] [cors] [cors.subdomain] [database] connection = mysql+pymysql://neutron:NEUTRON_DBPASS@controller/neutron [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = NEUTRON_PASS [matchmaker_redis] [nova] auth_url = http://controller:35357 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = nova password = NOVA_PASS [oslo_concurrency] lock_path = /var/lib/neutron/tmp [oslo_messaging_amqp] [oslo_messaging_notifications] [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS [oslo_policy] [qos] [quotas] [ssl]
3.1.3配置 Modular Layer 2 (ML2) 插件
ML2插件使用Linuxbridge机制来为实例创建layer-2虚拟网络基础设施
1.编辑“/etc/neutron/plugins/ml2/ml2_conf.ini
“文件并完成以下操作:
cp /etc/neutron/plugins/ml2/ml2_conf.ini{,.bak} grep '^\[' /etc/neutron/plugins/ml2/ml2_conf.ini.bak >/etc/neutron/plugins/ml2/ml2_conf.ini vim /etc/neutron/plugins/ml2/ml2_conf.ini
- 在“[ml2]“部分,启用flat和VLAN网络:
[ml2] ... type_drivers = flat,vlan
- 在“[ml2]“部分,禁用私有网络:
[ml2]
...
tenant_network_types =
-
在“[ml2]“部分,启用Linuxbridge机制:
[ml2] ... mechanism_drivers = linuxbridge
- 警告
在你配置完ML2插件之后,删除可能导致数据库不一致的“type_drivers“项的值。
-
在`
`[ml2]`
` 部分,启用端口安全扩展驱动:
[ml2] ... extension_drivers = port_security
-
在“[ml2_type_flat]“部分,配置公共虚拟网络为flat网络
[ml2_type_flat] ... flat_networks = provider
-
在
[securitygroup]
部分,启用 ipset 增加安全组规则的高效性:
[securitygroup] ... enable_ipset = True
- MD5值及配置文件内容:
#MD5值 [root@controller ~]# md5sum /etc/neutron/plugins/ml2/ml2_conf.ini c1562515b53c380cbd460621f4cf5362 /etc/neutron/plugins/ml2/ml2_conf.ini #配置文件内容 [root@controller ~]# cat /etc/neutron/plugins/ml2/ml2_conf.ini [DEFAULT] [ml2] type_drivers = flat,vlan tenant_network_types = mechanism_drivers = linuxbridge extension_drivers = port_security [ml2_type_flat] flat_networks = provider [ml2_type_geneve] [ml2_type_gre] [ml2_type_vlan] [ml2_type_vxlan] [securitygroup] enable_ipset = True
3.1.4配置Linuxbridge代理
Linuxbridge代理为实例建立layer-2虚拟网络并且处理安全组规则。
1.编辑“/etc/neutron/plugins/ml2/linuxbridge_agent.ini`
`文件并且完成以下操作:
cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini{,.bak} grep '^\[' /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak >/etc/neutron/plugins/ml2/linuxbridge_agent.ini vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
-
在“
[linux_bridge]
“部分,将公共虚拟网络和公共物理网络接口对应起来:
[linux_bridge] physical_interface_mappings = provider:eth0
eth0为底层的物理公共网络接口。
- 在`
`[vxlan]`
`部分,禁止VXLAN覆盖网络:
[vxlan] enable_vxlan = False
- 在
[securitygroup]
部分,启用安全组并配置 Linuxbridge iptables firewall driver:
[securitygroup] ... enable_security_group = True firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
- MD5值及配置文件内容:
#MD5值 [root@controller ~]# md5sum /etc/neutron/plugins/ml2/linuxbridge_agent.ini 3f474907a7f438b34563e4d3f3c29538 /etc/neutron/plugins/ml2/linuxbridge_agent.ini #配置文件内容 [root@controller ~]# cat /etc/neutron/plugins/ml2/linuxbridge_agent.ini [DEFAULT] [agent] [linux_bridge] physical_interface_mappings = provider:eth0 [securitygroup] enable_security_group = True firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver [vxlan] enable_vxlan = False
3.1.5配置DHCP代理
The DHCP agent provides DHCP services for virtual networks.
1.编辑“/etc/neutron/dhcp_agent.ini
“文件并完成下面的操作:
cp /etc/neutron/dhcp_agent.ini{,.bak} grep '^\[' /etc/neutron/dhcp_agent.ini.bak >/etc/neutron/dhcp_agent.ini vim /etc/neutron/dhcp_agent.ini
- 在“
[DEFAULT]
“部分,配置Linuxbridge驱动接口,DHCP驱动并启用隔离元数据,这样在公共网络上的实例就可以通过网络来访问元数据
[DEFAULT] ... interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = True
- MD5值及配置文件内容:
#MD5值 [root@controller ~]# md5sum /etc/neutron/dhcp_agent.ini cac841bdf855fe98617cd5907f2f5d5f /etc/neutron/dhcp_agent.ini #在[default]下增加下面三行 vim /etc/neutron/dhcp_agent.ini interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = True
3.2配置元数据代理
负责提供配置信息,例如:访问实例的凭证
3.2.1编辑“/etc/neutron/metadata_agent.ini
“文件并完成以下操作
- 在“[DEFAULT]“ 部分,配置元数据主机以及共享密码
[DEFAULT] ... nova_metadata_ip = controller metadata_proxy_shared_secret = METADATA_SECRET
用你为元数据代理设置的密码替换 METADATA_SECRET。
- MD5值及文件内容:
#MD5值 [root@controller ~]# md5sum /etc/neutron/metadata_agent.ini 6d69d28e7e1c9a12b262355047185f8c /etc/neutron/metadata_agent.ini vim /etc/neutron/metadata_agent.ini #在[default]下增加下面两行 nova_metadata_ip = controller metadata_proxy_shared_secret = METADATA_SECRET
3.3配置计算服务使用网络服务
3.3.1编辑“/etc/nova/nova.conf
“文件并完成以下操作
- 在“
[neutron]
“部分,配置访问参数,启用元数据代理并设置密码:
[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
- MD5值及配置文件内容:
#MD5值 [root@controller ~]# md5sum /etc/nova/nova.conf 0ebcefca67f2ecc4009b8fa73325a564 /etc/nova/nova.conf #配置文件内容 [root@controller ~]# cat /etc/nova/nova.conf [DEFAULT] enabled_apis = osapi_compute,metadata rpc_backend = rabbit auth_strategy = keystone my_ip = 118.190.201.11 use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver [api_database] connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api [barbican] [cache] [cells] [cinder] [conductor] [cors] [cors.subdomain] [database] connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova [ephemeral_storage_encryption] [glance] api_servers = http://controller:9292 [guestfs] [hyperv] [image_file_url] [ironic] [keymgr] [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = NOVA_PASS [libvirt] [matchmaker_redis] [metrics] [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 [osapi_v21] [oslo_concurrency] lock_path = /var/lib/nova/tmp [oslo_messaging_amqp] [oslo_messaging_notifications] [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS [oslo_middleware] [oslo_policy] [rdp] [serial_console] [spice] [ssl] [trusted_computing] [upgrade_levels] [vmware] [vnc] vncserver_listen = $my_ip vncserver_proxyclient_address = $my_ip [workarounds] [xenserver]
将 NEUTRON_PASS 替换为你在认证服务中为 neutron 用户选择的密码。
使用你为元数据代理设置的密码替换“METADATA_SECRET“
3.4完成安装
3.4.1网络服务初始化脚本需要一个超链接
- 将文件/etc/neutron/plugin.ini“指向ML2插件配置文件/etc/neutron/plugins/ml2/ml2_conf.ini“。
- 如果超链接不存在,使用下面的命令创建它:
[root@controller ~]# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
3.4.2同步数据库
~]# 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 INFO [alembic.runtime.migration] Running upgrade 5ffceebfada -> 4ffceebfcdc, standard_desc OK #验证结果 [root@controller ~]# mysql -uroot -p123456 -e "use neutron;show tables;"|wc -l 158
3.4.3重启(nova)计算API 服务
[root@controller ~]# systemctl restart openstack-nova-api.service
3.4.4当系统启动时,启动 Networking 服务并配置它启动
对于两种网络选项:
~]# 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
- 验证结果:
[root@controller ~]# neutron agent-list
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
| id | agent_type | host | availability_zone | alive | admin_state_up | binary |
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
| 20bdc143-a04d-40a5-a813-91b8359222b7 | DHCP agent | controller | nova | :-) | True | neutron-dhcp-agent |
| 60ff13b9-8354-42a6-a5cd-1638c2aaa557 | Metadata agent | controller | | :-) | True | neutron-metadata-agent |
| e864f5bb-63f2-441d-bb61-0066f999679c | Linux bridge agent | controller | | :-) | True | neutron-linuxbridge-agent |
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
对于网络选项2,同样启用layer-3服务并设置其随系统自启动
如果配置了就设置,本文没有配置,所有不执行
# systemctl enable neutron-l3-agent.service
# systemctl start neutron-l3-agent.service
4.安装和配置计算节点
在计算节点上执行如下操作
4.1安装组件
[root@compute1 ~]# yum install openstack-neutron-linuxbridge ebtables ipset -y
4.2配置通用组件
Networking 通用组件的配置包括认证机制、消息队列和插件。
注释说明: 在配置片段中的省略号(...)表示默认的配置选项你应该保留。
4.2.1编辑“/etc/neutron/neutron.conf
“ 文件并完成如下操作
cp /etc/neutron/neutron.conf{,.bak} grep '^\[' /etc/neutron/neutron.conf.bak >/etc/neutron/neutron.conf vim /etc/neutron/neutron.conf
- 在 “
[DEFAULT]
” 和 “[oslo_messaging_rabbit]
”部分,配置 “RabbitMQ” 消息队列的连接:
[DEFAULT] ... rpc_backend = rabbit [oslo_messaging_rabbit] ... rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS
用你在RabbitMQ中为“openstack“选择的密码替换 “RABBIT_PASS”。
- 在 “
[DEFAULT]
” 和 “[keystone_authtoken]
” 部分,配置认证服务访问
[DEFAULT] ... auth_strategy = keystone [keystone_authtoken] ... auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = NEUTRON_PASS
将 NEUTRON_PASS 替换为你在认证服务中为 neutron 用户选择的密码。
- 在 [oslo_concurrency] 部分,配置锁路径:
[oslo_concurrency] ... lock_path = /var/lib/neutron/tmp
MD5值及配置文件的内容:
#MD5值 [root@compute1 ~]# md5sum /etc/neutron/neutron.conf 77ffab503797be5063c06e8b956d6ed0 /etc/neutron/neutron.conf #配置文件内容 [root@compute1 ~]# cat /etc/neutron/neutron.conf [DEFAULT] rpc_backend = rabbit auth_strategy = keystone [agent] [cors] [cors.subdomain] [database] [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = NEUTRON_PASS [matchmaker_redis] [nova] [oslo_concurrency] lock_path = /var/lib/neutron/tmp [oslo_messaging_amqp] [oslo_messaging_notifications] [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS [oslo_policy] [qos] [quotas] [ssl]
4.3为计算节点配置网络服务
选择与您之前在控制节点上选择的相同的网络选项
注释说明: 把控制节点上的Linuxbridge代理配置文件/etc/neutron/plugins/ml2/linuxbridge_agent.ini拉到本地,因为内容是一样的 #在计算节点上执行如下命令 [root@compute1 ~]# scp controller:/etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini root@compute1's password: linuxbridge_agent.ini 100% 230 0.2KB/s 00:00 #检查文件内容 [root@compute1 ~]# cat /etc/neutron/plugins/ml2/linuxbridge_agent.ini [DEFAULT] [agent] [linux_bridge] physical_interface_mappings = provider:eth0 [securitygroup] enable_security_group = True firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver [vxlan] enable_vxlan = False
4.3.1编辑“/etc/nova/nova.conf
“文件并完成下面的操作
- 在“[neutron]“ 部分,配置访问参数:
[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
将 NEUTRON_PASS 替换为你在认证服务中为 neutron 用户选择的密码。
- MD5值及配置文件内容:
#MD5值 [root@compute1 ~]# md5sum /etc/nova/nova.conf c860f38f0a21e5350dabad9021a46f46 /etc/nova/nova.conf #配置文件内容 [root@compute1 ~]# cat /etc/nova/nova.conf [DEFAULT] rpc_backend = rabbit auth_strategy = keystone my_ip = 118.190.201.31 use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver [api_database] [barbican] [cache] [cells] [cinder] [conductor] [cors] [cors.subdomain] [database] [ephemeral_storage_encryption] [glance] api_servers = http://controller:9292 [guestfs] [hyperv] [image_file_url] [ironic] [keymgr] [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = NOVA_PASS [libvirt] [matchmaker_redis] [metrics] [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 [osapi_v21] [oslo_concurrency] lock_path = /var/lib/nova/tmp [oslo_messaging_amqp] [oslo_messaging_notifications] [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS [oslo_middleware] [oslo_policy] [rdp] [serial_console] [spice] [ssl] [trusted_computing] [upgrade_levels] [vmware] [vnc] enabled = True vncserver_listen = 0.0.0.0 vncserver_proxyclient_address = $my_ip novncproxy_base_url = http://controller:6080/vnc_auto.html [workarounds] [xenserver]
4.3.2完成安装
1.重启计算服务
[root@compute1 ~]# systemctl restart openstack-nova-compute.service
2.启动Linuxbridge代理并配置它开机自启动
[root@compute1 ~]# systemctl enable neutron-linuxbridge-agent.service [root@compute1 ~]# systemctl start neutron-linuxbridge-agent.service
3.验证是否成功
#控制节点执行如下命令 [root@controller ~]# neutron agent-list +--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+ | id | agent_type | host | availability_zone | alive | admin_state_up | binary | +--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+ | 20bdc143-a04d-40a5-a813-91b8359222b7 | DHCP agent | controller | nova | :-) | True | neutron-dhcp-agent | | 60ff13b9-8354-42a6-a5cd-1638c2aaa557 | Metadata agent | controller | | :-) | True | neutron-metadata-agent | | e864f5bb-63f2-441d-bb61-0066f999679c | Linux bridge agent | controller | | :-) | True | neutron-linuxbridge-agent | | ef18f134-3329-4ea0-8c0c-c6d24b4f1f98 | Linux bridge agent | compute1 | | :-) | True | neutron-linuxbridge-agent | +--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
5.验证操作
在控制节点上执行这些命令。
5.1获得 admin 凭证来获取只有管理员能执行的命令的访问权限
[root@controller ~]# source admin-openrc
5.2列出加载的扩展来验证“neutron-server
“进程是否正常启动
[root@controller ~]# neutron ext-list +---------------------------+-----------------------------------------------+ | alias | name | +---------------------------+-----------------------------------------------+ | default-subnetpools | Default Subnetpools | | availability_zone | Availability Zone | | network_availability_zone | Network Availability Zone | | auto-allocated-topology | Auto Allocated Topology Services | | binding | Port Binding | | agent | agent | | subnet_allocation | Subnet Allocation | | dhcp_agent_scheduler | DHCP Agent Scheduler | | tag | Tag support | | external-net | Neutron external network | | net-mtu | Network MTU | | network-ip-availability | Network IP Availability | | quotas | Quota management support | | provider | Provider Network | | multi-provider | Multi Provider Network | | address-scope | Address scope | | timestamp_core | Time Stamp Fields addition for core resources | | extra_dhcp_opt | Neutron Extra DHCP opts | | security-group | security-group | | rbac-policies | RBAC Policies | | standard-attr-description | standard-attr-description | | port-security | Port Security | | allowed-address-pairs | Allowed Address Pairs | +---------------------------+-----------------------------------------------+
Get busy living or get busy dying. 努力活出精彩的人生,否则便如行尸走肉
- 转载请注明来源:OpenStack系列五之网络服务Neutron
- 本文永久链接地址:https://www.xionghaier.cn/archives/539.html