第五章-网络服务之控制节点部署
第一步创建数据库
第二步创建`neutron``用户
创建``neutron``服务实体:
[root@openstack-1 ~]# openstack service create --name neutron \ > --description "OpenStack Networking" network +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Networking | | enabled | True | | id | e898872450d44c33b9ac063b616a234d | | name | neutron | | type | network | +-------------+----------------------------------+
创建网络服务API端点:
[root@openstack-1 ~]# openstack endpoint create --region RegionOne \ > network public http://192.168.10.131:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | d6db819f41c24956aef7e7d0315f17d0 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | e898872450d44c33b9ac063b616a234d | | service_name | neutron | | service_type | network | | url | http://192.168.10.131:9696 | +--------------+----------------------------------+ [root@openstack-1 ~]# openstack endpoint create --region RegionOne \ > network internal http://192.168.10.131:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 05aaf766053a494abb9e774b042a1431 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | e898872450d44c33b9ac063b616a234d | | service_name | neutron | | service_type | network | | url | http://192.168.10.131:9696 | +--------------+----------------------------------+ [root@openstack-1 ~]# openstack endpoint create --region RegionOne \ > network admin http://192.168.10.131:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | a29ed575110341d1a48b76dd2f89e60a | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | e898872450d44c33b9ac063b616a234d | | service_name | neutron | | service_type | network | | url | http://192.168.10.131:9696 | +--------------+----------------------------------+
网络选项1:公共网络
安装软件:
[root@openstack-1 ~]# yum install openstack-neutron openstack-neutron-ml2 \ > openstack-neutron-linuxbridge ebtables
配置网络服务
编辑``/etc/neutron/neutron.conf`` 文件并完成如下操作:
- 在 [database] 部分,配置数据库访问:
-
[database] connection = mysql+pymysql://neutron:neutron@192.168.10.172/neutron
- 在``[DEFAULT]``部分,启用ML2插件并禁用其他插件:
[DEFAULT] core_plugin = ml2 service_plugins =
- 在 “[DEFAULT]”部分,配置 “RabbitMQ” 消息队列的连接:
[DEFAULT] transport_url = rabbit://openstack:openstack@192.168.10.131
- 在 “[DEFAULT]” 和 “[keystone_authtoken]” 部分,配置认证服务访问:
[DEFAULT] auth_strategy = keystone [keystone_authtoken]
auth_uri = http://192.168.10.131:5000
auth_url = http://192.168.10.131:35357
memcached_servers = 192.168.10.131:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron
- 在``[DEFAULT]``和``[nova]``部分,配置网络服务来通知计算节点的网络拓扑变化:
[DEFAULT] notify_nova_on_port_status_changes = true notify_nova_on_port_data_changes = true [nova] auth_url = http://192.168.10.131:5000 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = nova password = nova
- 在 [oslo_concurrency] 部分,配置锁路径:
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
配置 Modular Layer 2 (ML2) 插件
ML2插件使用Linuxbridge机制来为实例创建layer-2虚拟网络基础设施
-
编辑``/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]`` 部分,启用端口安全扩展驱动:
-
[ml2] extension_drivers = port_security - 在``[ml2_type_flat]``部分,配置公共虚拟网络为flat网络
-
[ml2_type_flat] flat_networks = provider -
[securitygroup] enable_ipset = true
-
配置Linuxbridge代理
Linuxbridge代理为实例建立layer-2虚拟网络并且处理安全组规则。
-
编辑``/etc/neutron/plugins/ml2/linuxbridge_agent.ini``文件并且完成以下操作:
-
在``[linux_bridge]``部分,将公共虚拟网络和公共物理网络接口对应起来:
-
[linux_bridge] physical_interface_mappings = public:em1 - 在``[vxlan]``部分,禁止VXLAN覆盖网络:
-
[vxlan] enable_vxlan = False - 在 ``[securitygroup]``部分,启用安全组并配置 Linuxbridge iptables firewall driver:
-
[securitygroup] enable_security_group = true firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
-
配置DHCP代理
编辑``/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
配置元数据代理
编辑``/etc/neutron/metadata_agent.ini``文件并完成以下操作:
-
在``[DEFAULT]`` 部分,配置元数据主机以及共享密码:
-
[DEFAULT] nova_metadata_host = 192.168.10.131 metadata_proxy_shared_secret = yan
为计算节点配置网络服务
-
编辑``/etc/nova/nova.conf``文件并完成以下操作:
-
在``[neutron]``部分,配置访问参数,启用元数据代理并设置密码:
-
[neutron] url = http://192.168.10.131:9696 auth_url = http://192.168.10.131:5000 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = neutron password = neutron service_metadata_proxy = true metadata_proxy_shared_secret = yan
-
完成安装
-
网络服务初始化脚本需要一个超链接 /etc/neutron/plugin.ini``指向ML2插件配置文件/etc/neutron/plugins/ml2/ml2_conf.ini``。如果超链接不存在,使用下面的命令创建它
-
ln -sv /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
- 同步数据库:
-
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
- 重启计算API 服务:
-
systemctl restart openstack-nova-api.service
-
当系统启动时,启动 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@openstack-1 ~]# neutron agent-list neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. +--------------------------------------+--------------------+-------------+-------------------+-------+----------------+---------------------------+ | id | agent_type | host | availability_zone | alive | admin_state_up | binary | +--------------------------------------+--------------------+-------------+-------------------+-------+----------------+---------------------------+ | 1ba08c4a-716c-4fc0-849c-6d62a01eb9f1 | DHCP agent | openstack-1 | nova | :-) | True | neutron-dhcp-agent | | 621a2269-2f40-44c3-b380-fb769713bf81 | Metadata agent | openstack-1 | | :-) | True | neutron-metadata-agent | | d13ed171-6586-41a0-85f1-ceba4095048e | Linux bridge agent | openstack-1 | | :-) | True | neutron-linuxbridge-agent |
作者:闫世成
出处:http://cnblogs.com/yanshicheng

浙公网安备 33010602011771号