centos7安装openstack单机版5-neutron

  sre

5fc83e312334b2642.jpg_fo742.jpg

左大使系列文档

centos7安装openstack单机版1-环境准备
centos7安装openstack单机版2-kystone
centos7安装openstack单机版3-glance
centos7安装openstack单机版4-nova
centos7安装openstack单机版5-neutron
centos7安装openstack单机版6-Dashboard-horizon


安装neutron

准备工作

1、登录数据库,同keystone安装的登录数据库

容器环境:docker exec -ti mysql mysql -uroot -p123456

2、创建neutron相关库和账号

CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY '123456';

3、在keystone上创建neutron相关信息

向keystone验明身份:

source adminrc

创建neutron用户:

openstack user create --domain default --password-prompt neutron

设定密码:123456
将admin角色添加到neutron用户上:

openstack role add --project service --user neutron admin

创建neutron服务实体:

openstack service create --name neutron --description "OpenStack Networking" network

创建网络服务API endpoints:

openstack endpoint create --region RegionOne network public http://controller:9696
openstack endpoint create --region RegionOne network internal http://controller:9696
openstack endpoint create --region RegionOne network admin http://controller:9696

配置网络选项(使用provider networks模式)

1、安装网络组件:

yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables

2、配置数据库、认证、消息队列等信息:编辑配置文件/etc/neutron/neutron.conf

[database]处添加数据库信息:

connection = mysql+pymysql://neutron:123456@controller/neutron

[DEFAULT]处添加如下信息:

core_plugin = ml2
service_plugins =
transport_url = rabbit://openstack:123456@controller
auth_strategy = keystone
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true

[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 = 123456

[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 = 123456

[oslo_concurrency]处添加一行:

lock_path = /var/lib/neutron/tmp

3、配置模块layer2 插件信息:修改配置文件/etc/neutron/plugins/ml2/ml2_conf.ini

[ml2]处添加:

type_drivers = flat,vlan
tenant_network_types =            取消self-service networks
mechanism_drivers = linuxbridge      启用Linux bridge mechanism
extension_drivers = port_security     启用the port security extension driver
[ml2_type_flat]处添加一行
flat_networks = provider
[securitygroup]处添加一行
enable_ipset = true

4、配置Linux桥接agent:修改/etc/neutron/plugins/ml2/linuxbridge_agent.ini

[linux_bridge]处配置物理网卡名称

physical_interface_mappings = provider:物理网卡名称

[vxlan]处配置一行

enable_vxlan = false
[securitygroup]处配置一行
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

5、配置dhcp agent:修改/etc/neutron/dhcp_agent.ini

[DEFAULT]
interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true

开启配置metadata agent

1、修改配置文件/etc/neutron/metadata_agent.ini

[DEFAULT]
nova_metadata_host = controller
metadata_proxy_shared_secret = METADATA_SECRET

(使用neutron或者matadata或者其他都可以,保持和下面一直,这是自定义的密钥),这里采用neutron

2、配置计算服务能够使用网络服务:修改/etc/nova/nova.conf

图片51.png

3、创建软连接:

ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

4、初始化数据库

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

验证:有下列返回则正常。
图片52.png

5、重启nova-api服务:

systemctl restart openstack-nova-api

6、启动neutron服务:

systemctl enable neutron-server  neutron-linuxbridge-agent neutron-dhcp-agent neutron-metadata-agent
systemctl start neutron-server  neutron-linuxbridge-agent neutron-dhcp-agent neutron-metadata-agent

验证:
分别查看/var/log/neutron目录下的几个日志是否有报错信息
图片53.png

以上控制节点的网络服务就安装完毕。

在计算节点上安装neutron服务

1、安装软件包:

yum install openstack-neutron-linuxbridge ebtables ipset

2、因为是单机部署,配置基本都不用改,直接重启下服务

systemctl restart openstack-nova-compute

验证服务

openstack network agent list

图片54.png

LEAVE A COMMENT

Captcha Code