OpenStack Newton版本部署
OpenStack Networking(neutron)允许您创建并附加由其他OpenStack服务管理的接口设备到网络。
它包括以下组件:
neutron-server
接受并将API请求路由到相应的OpenStack Networking插件以进行操作。
OpenStack Networking plug-ins andagents
Messaging queue
安装和配置控制节点
先决条件
1、
1)root用户登录数据库
$mysql -u root -p
2)创建neutron数据库
mysql> CREATE DATABASE neutron;
mysql> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \
IDENTIFIED BY 'NEUTRON_DBPASS';
mysql> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \
IDENTIFIED BY 'NEUTRON_DBPASS';
2、创建服务凭证
1)输入管理员凭证
$. admin-openrc
$openstack user create --domain default --password-prompt neutron
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field| Value |
+---------------------+----------------------------------+
| domain_id| default |
| enabled| True |
| id| 319f34694728440eb8ffcb27 b6dd8b8a |
| name| neutron |
| password_expires_at | None|
+---------------------+----------------------------------+
$openstack role add --project service --user neutron admin
$openstack service create --name nova \
"OpenStack Compute" --description compute
+-------------+----------------------------------+
| Field| Value |
+-------------+----------------------------------+
| description | OpenStack Compute|
| enabled| True |
| id| 060d59eac51b4594815603d7 5a00aba2 |
| name| nova |
| type| compute |
+-------------+----------------------------------+
3、创建neutron服务API端口:
$openstack endpoint create --region RegionOne \
network public http://controller:9696
+--------------+----------------------------------+
| Field| Value |
+--------------+----------------------------------+
| enabled| True |
| id| 85d80a6d02fc4b7683f611d7 fc1493a3 |
| interface| public |
| region| RegionOne |
| region_id| RegionOne |
| service_id| f71529314dab4a4d8eca427e 701d209e |
| service_name | neutron|
| service_type | network|
| url| http://controller:9696 |
+--------------+----------------------------------+
$openstack endpoint create --region RegionOne \
network internal http://controller:9696
+--------------+----------------------------------+
| Field| Value |
+--------------+----------------------------------+
| enabled| True |
| id| 09753b537ac74422a68d2d79 1cf3714f |
| interface| internal |
| region| RegionOne |
| region_id| RegionOne |
| service_id| f71529314dab4a4d8eca427e 701d209e |
| service_name | neutron|
| service_type | network|
| url| http://controller:9696 |
+--------------+----------------------------------+
$openstack endpoint create --region RegionOne \
network admin http://controller:9696
+--------------+----------------------------------+
| Field| Value |
+--------------+----------------------------------+
| enabled| True |
| id| 1ee14289c9374dffb5db92a5 c112fc4e |
| interface| admin |
| region| RegionOne |
| region_id| RegionOne |
| service_id| f71529314dab4a4d8eca427e 701d209e |
| service_name | neutron|
| service_type | network|
| url| http://controller:9696 |
+--------------+----------------------------------+
配置网络选项
1、安装
#yum install openstack-neutron openstack-neutron-ml2 \
openstack-neutron-linuxbridge ebtables
2、
1)配置数据库访问
[database]
...
connection= mysql+pymysql://neutron:NEUTRON_DBPASS@controller/neutron
用合适密码替换NEUTRON_DBPASS。
2)
[DEFAULT]
...
core_plugin= ml2
service_plugins= router
allow_overlapping_ips= True
3)配置RabbitMQ消息队列访问:
[DEFAULT]
...
transport_url= rabbit://openstack:RABBIT_PASS@controller
用openstack用户的队列密码替换RABBIT_PASS。
4)配置认证服务访问
[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用户的密码替换NEUTRON_PASS。
5)配置Networking通知Compute网络拓扑变化:
[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。
6)配置锁定路径:
[oslo_concurrency]
...
lock_path= /var/lib/neutron/tmp
用命令
3、配置ML2插件
vim
1)启动flat,,VLAN和VXLAN网络。
[ml2]
...
type_drivers= flat,vlan,vxlan
2)
[ml2]
...
tenant_network_types= vxlan
3)启动Linux bridge和L2 population机制:
[ml2]
...
mechanism_drivers= linuxbridge,l2population
4)启动端口安全扩展驱动程序:
[ml2]
...
extension_drivers= port_security
5)将提供商虚拟网络配置为flat网络:
[ml2_type_flat]
...
flat_networks= provider
[ml2_type_vxlan]
...
vni_ranges= 1:1000
7)启用ipset来提高安全组规则的效率:
[securitygroup]
...
enable_ipset= True
用命令
vim
1)将提供商虚拟网络映射到提供商物理网络接口。
[linux_bridge]
physical_interface_mappings= provider:PROVIDER_INTERFACE_NAME
将PROVIDER_INTERFACE_NAME替换为控制节点外网网卡,例如eno1.
2)
[vxlan]
enable_vxlan= True
local_ip= OVERLAY_INTERFACE_IP_ADDRESS
l2_population= True
3)启动安全组并配置Linux bridge iptables防火墙驱动:
[securitygroup]
...
enable_security_group= True
firewall_driver= neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
4)检查配置
用命令
5、配置L3代理
vim
1)配置Linux bridge接口驱动和外网网桥
[DEFAULT]
...
interface_driver= neutron.agent.linux.interface.BridgeInterfaceDriver
6、配置DHCP代理
vim
1)配置Linux bridge接口驱动,DnsmasqDHCP驱动,并启动启用隔离的元数据,从而提供商网络上的实例可以通过网络访问元数据:
[DEFAULT]
...
interface_driver= neutron.agent.linux.interface.BridgeInterfaceDriver
dhcp_driver= neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata= True
vim
1)配置元数据主机和共享密匙:
[DEFAULT]
...
nova_metadata_ip= controller
metadata_proxy_shared_secret= METADATA_SECRET
为元数据代理选择合适的密匙替代METADATA_SECRET。
配置compute服务以使用networking服务
1、vim
1)配置访问参数,启动元数据代理:
[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
用neutron用户密码替换NEUTRON_PASS。
用元数据代理密匙替换METADATA_SECRET。
完成安装
1、
#ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
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
MariaDB [(none)]> useneutron;
MariaDB [neutron]> showtables;
3、
#systemctl restart openstack-nova-api.service
4、
#systemctl enableneutron-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
#systemctl enableneutron-l3-agent.service
#systemctl start neutron-l3-agent.service