在 controller 节点安装和配置网络组件。
# yum install openstack-neutron openstack-neutron-ml2 \
openstack-neutron-linuxbridge python-neutronclient ebtables ipset
Networking 服务器组件的配置包括数据库、认证机制、消息队列、拓扑变化通知和插件。
注解
默认配置文件在各发行版本中可能不同。你可能需要添加这些部分和选项而不是修改已经存在的部分和选项。另外,在配置片段中的省略号(...)表示默认的配置选项你应该保留。
编辑``/etc/neutron/neutron.conf`` 文件并完成如下动作:
在 [database] 部分,配置数据库访问:
[database]
...
connection = mysql://neutron:NEUTRON_DBPASS@controller/neutron
使用你选择的数据库密码替换 NEUTRON_DBPASS 。
在``[DEFAULT]``部分,启用Modular Layer 2 (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
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = NEUTRON_PASS
将 NEUTRON_PASS 替换为你在认证服务中为 neutron 用户选择的密码。
注解
在 [keystone_authtoken] 中注释或者删除其他选项。
在``[DEFAULT]``和``[nova]``部分,配置网络以能够反映计算网络拓扑变化:
[DEFAULT]
...
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
nova_url = http://controller:8774/v2
[nova]
...
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = 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
(可选的)为帮助排错,在 “[DEFAULT]”部分启用详细日志。
[DEFAULT]
...
verbose = True
ML2插件使用Linux桥接机制为实例创建layer-2 (桥接/交换)虚拟网络基础设施。
编辑``/etc/neutron/plugins/ml2/ml2_conf.ini`` 文件并完成下面的操作:
在``[ml2]``部分,启用 flat 和 VLAN 网络:
[ml2]
...
type_drivers = flat,vlan
在 ``[ml2]``部分,禁用项目(私有)网络:
[ml2]
...
tenant_network_types =
在 [ml2] 部分,启用Linux 桥接机制:
[ml2]
...
mechanism_drivers = linuxbridge
警告
在你配置ML2插件后,删除可能导致数据库不一致的``type_drivers``项的值。
在``[ml2]`` 部分,启用端口安全扩展驱动:
[ml2]
...
extension_drivers = port_security
在``[ml2_type_flat]``部分,配置公共flat提供网络:
[ml2_type_flat]
...
flat_networks = public
在 ``[securitygroup]``部分,启用 ipset 增加安全组的方便性:
[securitygroup]
...
enable_ipset = True
Linux桥接代理为实例创建包括私有网络的VXLAN隧道和处理安全组的layer-2(桥接/交换)虚拟网络设施。
编辑``/etc/neutron/plugins/ml2/linuxbridge_agent.ini``文件并完成下面的操作:
在``[linux_bridge]`` 部分,映射公共虚拟网络到公共物理网络接口:
[linux_bridge]
physical_interface_mappings = public:PUBLIC_INTERFACE_NAME
将``PUBLIC_INTERFACE_NAME`` 替换为物理公共网络接口。
在``[vxlan]`` 部分,禁用 VXLAN overlay 网络:
[vxlan]
enable_vxlan = False
在``[agent]``部分,启用ARP欺骗防护:
[agent]
...
prevent_arp_spoofing = True
在 ``[securitygroup]``部分,启用安全组并配置 Linux 桥接 iptables 防火墙驱动:
[securitygroup]
...
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
The DHCP agent provides DHCP services for virtual networks.
编辑``/etc/neutron/dhcp_agent.ini``文件并完成下面的操作:
在``[DEFAULT]``部分,配置Linux桥接网卡驱动,Dnsmasq DHCP驱动并启用隔离元数据,这样在公共网络上的实例就可以通过网络访问元数据:
[DEFAULT]
...
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
(可选的)为帮助排错,在 “[DEFAULT]”部分启用详细日志。
[DEFAULT]
...
verbose = True
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.