openstack核心组件-neutron-网络服务

neutron 介绍:

控制节点:

创建库

#mysql -uroot -p123

>CREATE DATABASE neutron;

创建用户赋予权限

> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \
IDENTIFIED BY 'NEUTRON_DBPASS';
> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \
IDENTIFIED BY 'NEUTRON_DBPASS';

#source openrc

创建neutron用户

#openstack user create --domain default --password=neutron neutron

设置为管理员

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

创建服务

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

创建服务端口

#openstack endpoint create --region RegionOne \
network public http://pikachu1:9696
#openstack endpoint create --region RegionOne \
network internal http://pikachu1:9696
#openstack endpoint create --region RegionOne \
network admin http://pikachu1:9696

安装软件包

#yum install openstack-neutron openstack-neutron-ml2 openvswitch openstack-neutron-openvswitch ebtables -y 

修改neutron主配置文件

#cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak
#vim /etc/neutron/neutron.conf

[DEFAULT]
state_path = /var/lib/neutron
auth_strategy = keystone
认证方式
core_plugin = ml2
service_plugins = router
安装虚拟路由器
dhcp_agent_notification = true
allow_overlapping_ips = True
隧道类型网络
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
transport_url = rabbit://openstack:admin@pikachu1

[agent]

[cors]

[cors.subdomain]

[database]
connection = mysql+pymysql://neutron:NEUTRON_DBPASS@pikachu1/neutron

[keystone_authtoken]
auth_uri = http://pikachu1:5000
auth_url = http://pikachu1:35357
memcached_servers = pikachu1:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron

[matchmaker_redis]

[nova]
region_name = RegionOne
auth_url = http://pikachu1:35357
auth_type = password
project_domain_name = default
project_name = service
user_domain_name = default
username = nova
password = nova

[oslo_concurrency]
lock_path = $state_path/lock

[oslo_messaging_amqp]

[oslo_messaging_kafka]

[oslo_messaging_notifications]

[oslo_messaging_rabbit]

[oslo_messaging_zmq]

[oslo_middleware]

[oslo_policy]

[qos]

[quotas]

[ssl]

编辑ml2核心插件

#cp /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini.bak
#vim /etc/neutron/plugins/ml2/ml2_conf.ini

[DEFAULT]

[ml2]
type_drivers = flat,vxlan
tenant_network_types = vxlan
mechanism_drivers = openvswitch,l2population
机制驱动.l2population-vxlan
extension_drivers = port_security
外部网络驱动-安全端口

[ml2_type_flat]

[ml2_type_geneve]

[ml2_type_gre]

[ml2_type_vlan]

[ml2_type_vxlan]
vni_ranges = 1:1000
vxlan标记范围

[securitygroup]
enable_ipset = true
是否开启安全组(防火墙)

编辑openvswitch配置文件

#cp /etc/neutron/plugins/ml2/openvswitch_agent.ini /etc/neutron/plugins/ml2/openvswitch_agent.ini.bak
#vim /etc/neutron/plugins/ml2/openvswitch_agent.ini

[DEFAULT]

[agent]
tunnel_types = vxlan
l2_population = True

[ovs]
tunnel_bridge = br-tun
local_ip = 192.168.146.54
第二块网卡ip(租户网)
bridge_mappings =

[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = true

[xenapi]

编辑layer-3(提供3层路由器)

#cp /etc/neutron/l3_agent.ini /etc/neutron/l3_agent.ini.bak
#vim /etc/neutron/l3_agent.ini

[DEFAULT]
interface_driver = openvswitch
external_network_bridge = br-ex
外部网桥-br-ex(外网网卡做出的网桥)需要第三块网卡(外网)

[agent]

[ovs]

编辑dhcp agent

#cp /etc/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini.bak
#vim /etc/neutron/dhcp_agent.ini

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

[agent]

[ovs]

修改metadata agent

#cp /etc/neutron/metadata_agent.ini /etc/neutron/metadata_agent.ini.bak
#vim /etc/neutron/metadata_agent.ini

[DEFAULT]
nova_metadata_ip = pikachu1
metadata_proxy_shared_secret = METADATA_SECRET
元数据密码 与 /etc/nova/nova.conf [neutron]对应

[agent]

[cache]

编辑nova配置文件

#vim /etc/nova/nova.conf
把[neutron]项的注释打开

创建连接

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

同步neutron数据库

#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

重启服务

#systemctl restart openstack-nova-api.service

#systemctl enable neutron-server.service neutron-dhcp-agent.service openvswitch neutron-openvswitch-agent neutron-metadata-agent.service

#systemctl start neutron-server.service neutron-dhcp-agent.service openvswitch neutron-openvswitch-agent neutron-metadata-agent.service

查看服务

#neutron agent-list

#openstack network agent list

创建br-ex网桥,连接接口

#ovs-vsctl add-br br-ex

#ovs-vsctl add-port br-ex eth2

#ovs-vsctl show

开启路由功能

#systemctl enable neutron-l3-agent.service

#systemctl start neutron-l3-agent.service

计算节点

安装软件

#yum -y install openvswitch openstack-neutron-openvswitch ebtables ipset
如果yum失败,执行
#yum clean all
#yum makecache

编辑neutron文件

#cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak
#vim /etc/neutron/neutron.conf

[DEFAULT]
auth_strategy = keystone
transport_url = rabbit://openstack:admin@pikachu1

[agent]

[cors]

[cors.subdomain]

[database]

[keystone_authtoken]
auth_uri = http://pikachu1:5000
auth_url = http://pikachu1:35357
memcached_servers = pikachu1:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron

[matchmaker_redis]

[nova]

[oslo_concurrency]
lock_path = $state_path/lock

[oslo_messaging_amqp]

[oslo_messaging_kafka]

[oslo_messaging_notifications]

[oslo_messaging_rabbit]

[oslo_messaging_zmq]

[oslo_middleware]

[oslo_policy]

[qos]

[quotas]

[ssl]

编辑openvswitch配置文件

#cp /etc/neutron/plugins/ml2/openvswitch_agent.ini /etc/neutron/plugins/ml2/openvswitch_agent.ini.bak
#vim /etc/neutron/plugins/ml2/openvswitch_agent.ini

[DEFAULT]

[agent]
tunnel_types = vxlan
l2_population = True

[ovs]
tunnel_bridge = br-tun
local_ip = 192.168.146.55
第二块网卡ip(租户网)
bridge_mappings =

[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = true

[xenapi]

编辑nova配置文件

#vim /etc/nova/nova.conf

[neutron]
url = http://pikachu1:9696
auth_url = http://pikachu1:35357
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 = METADATA_SECRET

启动服务

#systemctl enable openvswitch neutron-openvswitch-agent

#systemctl start openvswitch neutron-openvswitch-agent

#systemctl stop openvswitch neutron-openvswitch-agent#

猜你喜欢

转载自blog.csdn.net/PpikachuP/article/details/89256125