openstack部署neutron

Posted daisyyang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openstack部署neutron相关的知识,希望对你有一定的参考价值。

controller

 

  1.创建数据库并设置权限

  mysql -u root -p0330

  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‘;

  2.创建openstack用户

  source openrc

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

  3.给neutron设置成admin角色

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

  4.创建服务

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

  5.创建服务端点

  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

  6.安装服务

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

   7.编辑配置文件(第三块网卡不配置ip)
  cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak
  cp /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini.bak
  cp /etc/neutron/plugins/ml2/openvswitch_agent.ini /etc/neutron/plugins/ml2/openvswitch_agent.ini.bak
  cp /etc/neutron/l3_agent.ini /etc/neutron/l3_agent.ini.bak
  cp/etc/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini.bak
  cp /etc/neutron/metadata_agent.ini /etc/neutron/metadata_agent.ini.bak
技术图片
[DEFAULT]
state_path = /var/lib/neutron       #neutron扩展库目录
auth_strategy = keystone   #认证方式
core_plugin = ml2            #核心插件
service_plugins = router        #服务插件:路由
dhcp_agent_notification = true   #开启dhcp自动分配IP
allow_overlapping_ips = True
notify_nova_on_port_status_changes = true         #允许更改端口
notify_nova_on_port_data_changes = true             #更改端口的元数据
transport_url = rabbit://openstack:[email protected]

[agent]

[cors]

[cors.subdomain]

[database]
connection = mysql+pymysql://neutron:[email protected]/neutron

[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

[matchmaker_redis]

[nova]
region_name = RegionOne
auth_url = http://controller: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]
 
vim /etc/neutron/neutron.conf
技术图片
[DEFAULT]

[ml2]
type_drivers = flat,vxlan       #类型驱动
tenant_network_types = vxlan           #租户网络类型
mechanism_drivers = openvswitch,l2population    
extension_drivers = port_security

[ml2_type_flat]

[ml2_type_geneve]

[ml2_type_gre]

[ml2_type_vlan]

[ml2_type_vxlan]
vni_ranges = 1:1000        #vlan的id号码的取值范围

[securitygroup]
enable_ipset = true     #开启安全组策略
vim /etc/neutron/plugins/ml2/ml2_conf.bak
技术图片
[DEFAULT]

[agent]
tunnel_types = vxlan   #隧道类型
l2_population = True

[ovs]
tunnel_bridge = br-tun   #隧道网桥
local_ip = 192.168.42.147     #租户网的ip地址
bridge_mappings =

[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = true

[xenapi]
vim /etc/neutron/plugins/ml2/openvswitch_agent.ini
技术图片
[DEFAULT]
interface_driver = openvswitch   1路由由openswitch做出来的
external_network_bridge = br-ex   #外网的网桥

[agent]

[ovs]
vim /etc/neutron/l3_agent.ini
技术图片
[DEFAULT]
interface_driver = openvswitch
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true    #开启元数据

[agent]

[ovs]
vim /etc/neutron/dhcp_agent.ini
技术图片
[DEFAULT]
nova_metadata_ip = controller
metadata_proxy_shared_secret = METADATA_SECRET   #元数据证书的密码

[agent]

[cache]
vim /etc/neutron/metadata_agent.ini

  8.编辑nova的配置文件

技术图片
[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
vim /etc/nova/nova.conf

  9.创建软链接

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

  10.同步数据库

  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

  11.重启服务

  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

    12.创建网桥

   ovs-vsctl add-br br-ex

 

  ovs-vsctl add-port br-ex eth38
   ovs-vsctl show
    13.开启l3-agent
    systemctl enable neutron-l3-agent.service
    systemctl enable neutron-l3-agent.service
  14.查看neutron服务状态
  openstack  neutron service list
 
compute
 
  1.安装服务
    yum install openvswitch openstack-neutron-openvswitch ebtables ipset
    2.编辑配置文件
    cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak
    cp /etc/neutron/plugins/ml2/openswitch_agent.ini /etc/neutron/plugins/ml2/openswitch_agent.ini.bak
技术图片
[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:[email protected]

[agent]

[cors]

[cors.subdomain]

[database]
#connection = mysql+pymysql://neutron:[email protected]/neutron

[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

[matchmaker_redis]

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

[oslo_concurrency]
lock_path = /var/lib/neutron/tmp

[oslo_messaging_amqp]

[oslo_messaging_kafka]

[oslo_messaging_notifications]

[oslo_messaging_rabbit]

[oslo_messaging_zmq]

[oslo_middleware]

[oslo_policy]

[qos]

[quotas]

[ssl]
vim /etc/neutron/neutron.conf
技术图片
[DEFAULT]

[agent]
tunnel_types = vxlan
l2_population = True

[ovs]
tunnel_bridge = br-tun
local_ip = 192.168.42.151
bridge_mappings =

[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = true

[xenapi]
vim /etc/neutron/plugins/ml2/openswitch_agent.ini

    3.编辑nova配置文件

技术图片
[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
vim /etc/nova/nova.conf

    4.重启服务

    systemctl restart openstack-nova-compute.service

    systemctl enable openvswitch neutron-openvswitch-agent

      systemctl start openvswitch neutron-openvswitch-agent
    5.到控制节点查看
    openstack  neutron service list
  以上是neutron的安装,如果需要的话也可以在storage节点上部署neutron服务。

以上是关于openstack部署neutron的主要内容,如果未能解决你的问题,请参考以下文章

OpenStack 运维 - 部署Neutron组件[T版]

openstack Q版部署-----网络服务(neutron)安装部署

OpenStack kilo版 Neutron部署

OpenStack的部署T版——Neutron组件

OpenStack的部署T版——Neutron组件

openstack部署neutron