openstack学习(五):neutron、dashboard配置以及使用

记录,方便查阅。


neutron配置

controller节点的配置

数据库建立:

mysql -p123456 -e "CREATE DATABASE neutron;GRANT ALL PRIVILEGES ON neutron.* TO ‘neutron‘@‘192.168.23.11‘ IDENTIFIED BY ‘neutron‘;GRANT ALL PRIVILEGES ON neutron.* TO ‘neutron‘@‘%‘ IDENTIFIED BY ‘neutron‘;"

创建keystone中用户、服务等:

keystone user-create --name neutron --pass neutron
keystone user-role-add --user neutron --tenant service --role admin
keystone service-create --name neutron --type network --description "OpenStack Networking"

keystone endpoint-create \--service-id $(keystone service-list | awk ‘/ network / {print $2}‘) \--publicurl http://controller:9696 \--adminurl http://controller:9696 \--internalurl http://controller:9696 \--region regionOne

软件安装:

yum install openstack-neutron openstack-neutron-ml2 python-neutronclient which -y

编辑配置文件/etc/neutron/neutron.conf

[database]
connection = mysql://neutron:[email protected]:controller/neutron

[DEFAULT]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://controller:5000/v2.0
identity_uri = http://controller:35357
admin_tenant_name = service
admin_user = neutron
admin_password = neutron

[DEFAULT]    #ml2插件配置
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True

[DEFAULT]
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
nova_url = http://controller:8774/v2
nova_admin_auth_url = http://controller:35357/v2.0
nova_region_name = regionOne
nova_admin_username = nova
nova_admin_tenant_id =295f25713db645feb19b246c1c249bb4
nova_admin_password = nova

[DEFAULT]
verbose = True

编辑配置文件/etc/neutron/plugins/ml2/ml2_conf.ini

[ml2]
type_drivers = flat,gre  #网络类型
tenant_network_types = gre
mechanism_drivers = openvswitch

[ml2_type_gre]
tunnel_id_ranges = 1:1000  #gre网络标识范围

[securitygroup]    #启用安全组,使用iptables规则
enable_security_group = True
enable_ipset = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver

编辑配置文件/etc/nova/nova.conf

[DEFAULT]
network_api_class = nova.network.neutronv2.api.API
security_group_api = neutron
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver    #禁用内部防火墙驱动,以接管

[neutron]    #配置访问参数
url = http://controller:9696
auth_strategy = keystone
admin_auth_url = http://controller:35357/v2.0
admin_tenant_name = service
admin_username = neutron
admin_password = neutron

为了初始化网络服务,使用符号链接到配置文件夹中

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

填充数据库

sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade juno" neutron

重启nova中一些服务:

systemctl restart openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service

启动neutron和自启动:

systemctl enable neutron-server.service
systemctl start neutron-server.service

以下为网络节点的配置,这里集成到controller配置:

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

编辑配置文件vim /etc/sysctl.conf

net.ipv4.ip_forward=1  #打开数据转发
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0

应用更改:

sysctl –p

编辑配置文件/etc/neutron/neutron.conf

[DEFAULT]
rpc_backend = rabbit
rabbit_host = controller
rabbit_password = guest
[DEFAULT]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://controller:5000/v2.0
identity_uri = http://controller:35357
admin_tenant_name = service
admin_user = neutron
admin_password = neutron
[DEFAULT]
core_plugin = ml2  #打开ml2
service_plugins = router  #打开router
allow_overlapping_ips = True  #允许IP重叠
[DEFAULT]
verbose = True

编辑配置文件/etc/neutron/plugins/ml2/ml2_conf.ini

[ml2]
type_drivers = flat,gre
tenant_network_types = gre
mechanism_drivers = openvswitch

[ml2_type_flat]
flat_networks = external  #配置flat网络提供为外部网络

[ml2_type_gre]
tunnel_id_ranges = 1:1000

[securitygroup]
enable_security_group = True
enable_ipset = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver

[ovs]
local_ip = 192.168.24.1  #gre本地IP,tunnel端点
enable_tunneling = True
bridge_mappings = external:br-ex  #映射关系

[agent]
tunnel_types = gre

编辑配置文件/etc/neutron/l3_agent.ini

[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
use_namespaces = True  #打开namespace
external_network_bridge = br-ex  #外部网络的网桥
router_delete_namespaces = True  #启用删除namespace功能

[DEFAULT]
verbose = True

编辑配置文件/etc/neutron/dhcp_agent.ini

[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
use_namespaces = True
dhcp_delete_namespaces = True
[DEFAULT]
verbose = True

编辑配置文件/etc/neutron/metadata_agent.ini

[DEFAULT]
auth_url = http://controller:5000/v2.0
auth_region = regionOne
admin_tenant_name = service
admin_user = neutron
admin_password = neutron

[DEFAULT]
nova_metadata_ip = controller

[DEFAULT]
metadata_proxy_shared_secret = yippee

[DEFAULT]
verbose = True

编辑配置文件/etc/nova/nova.conf

[neutron]
service_metadata_proxy = True  #打开metadata代理
metadata_proxy_shared_secret = yippee
启动和自启动:
systemctl restart openstack-nova-api.service
systemctl enable openvswitch.service
systemctl start openvswitch.service

添加网桥并添加端口:

ovs-vsctl add-br br-ex  
ovs-vsctl add-port br-ex enps9
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

这是一个bug,复制脚本文件:

cp /usr/lib/systemd/system/neutron-openvswitch-agent.service /usr/lib/systemd/system/neutron-openvswitch-agent.service.orig
sed -i ‘s,plugins/openvswitch/ovs_neutron_plugin.ini,plugin.ini,g‘ /usr/lib/systemd/system/neutron-openvswitch-agent.service

启动和自启动:

systemctl enable neutron-openvswitch-agent.service neutron-l3-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service neutron-ovs-cleanup.service
systemctl start neutron-openvswitch-agent.service neutron-l3-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service

compute节点配置

安装包:

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

/etc/sysctl.conf

net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
sysctl –p

下面不做过多解释:

/etc/neutron/neutron.conf

[DEFAULT]
rpc_backend = rabbit
rabbit_host = controller
#rabbit_password = guest
[DEFAULT]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://controller:5000/v2.0
identity_uri = http://controller:35357
admin_tenant_name = service
admin_user = neutron
admin_password = neutron
[DEFAULT]
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True
[DEFAULT]
verbose = True

/etc/neutron/plugins/ml2/ml2_conf.ini

[ml2]
type_drivers = flat,gre
tenant_network_types = gre
mechanism_drivers = openvswitch
[ml2_type_gre]
tunnel_id_ranges = 1:1000

[securitygroup]
enable_security_group = True
enable_ipset = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
[ovs]
local_ip = 192.168.24.2
enable_tunneling = True
[agent]
tunnel_types = gre
systemctl enable openvswitch.service
systemctl start openvswitch.service

/etc/nova/nova.conf

[DEFAULT]
network_api_class = nova.network.neutronv2.api.API
security_group_api = neutron
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver

[neutron]
url = http://controller:9696
auth_strategy = keystone
admin_auth_url = http://controller:35357/v2.0
admin_tenant_name = service
admin_username = neutron
admin_password = neutron
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
cp /usr/lib/systemd/system/neutron-openvswitch-agent.service /usr/lib/systemd/system/neutron-openvswitch-agent.service.orig
sed -i ‘s,plugins/openvswitch/ovs_neutron_plugin.ini,plugin.ini,g‘ /usr/lib/systemd/system/neutron-openvswitch-agent.service
systemctl restart openstack-nova-compute.service
systemctl enable neutron-openvswitch-agent.service
systemctl start neutron-openvswitch-agent.service

neutron使用

查看agent:

neutron agent-list

创建网络:

neutron net-create ext-net --router:external True --provider:physical_network external --provider:network_type flat  #创建一个外部网络
neutron subnet-create ext-net --name ext-subnet --allocation-pool start=10.0.3.201,end=10.0.3.254 --disable-dhcp --gateway 10.0.3.1 10.0.3.0/24  #外部网络子网
neutron net-create demo-net  #租户网络
neutron subnet-create demo-net --name demo-subnet --gateway 192.168.1.1 192.168.1.0/24  #租户子网
neutron router-create demo-router  #路由
neutron router-interface-add demo-router demo-subnet   #关联路由与网关
neutron router-gateway-set demo-router ext-net  #路由网关

dashboard(horizon)配置

安装包:

yum install openstack-dashboard httpd mod_wsgi memcached pythonmemcached

编辑配置文件/etc/openstack-dashboard/local_settings

OPENSTACK_HOST = "controller"
ALLOWED_HOSTS = [‘*‘]
CACHES = {
‘default‘: {
‘BACKEND‘: ‘django.core.cache.backends.memcached.MemcachedCache‘,
‘LOCATION‘: ‘127.0.0.1:11211‘,
}
}
TIME_ZONE = " Asia/Chongqing"
setsebool -P httpd_can_network_connect on  #配置selinux相关

权限修改:

chown -R apache:apache /usr/share/openstack-dashboard/static

启动和自启动:

systemctl enable httpd.service memcached.service
systemctl start httpd.service memcached.service

dashboard使用

http://192.168.25.11/dashboard

至此,openstack重要组件完成部署。

时间: 2024-10-16 08:05:00

openstack学习(五):neutron、dashboard配置以及使用的相关文章

OpenStack学习之Cinder LVM 配置

0.背景 OpenStack 中的实例是不能持久化的,需要挂载 volume,在 volume 中实现持久化.Cinder提供持久的块存储,目前仅供给虚拟机挂载使用.它并没有实现对块设备的管理和实际服务,而是为后端不同的存储结构提供了统一的接口,不同的块设备服务厂商在 Cinder 中实现其驱动支持以与 OpenStack 进行整合.它通过整合后端多种存储,用API接口为外界提供存储服务.主要核心是对卷的管理,允许都卷.类型和快照进行处理. Cinder存储分为本地块存储.分布式块存储和SAN存

Spring学习五、Java配置Spring与代理模式

九.使用Java的方式配置Spring JavaConfig是Spring的一个子项目,在Spring4之后,成为了核心功能 @Configuration public class MyConfig { @Bean public User getUser() { return new User(); } } 纯Java配置,在SpringBoot中随处可见 十.代理模式 代理模式是SpringAOP的底层! 代理模式的分类 静态分类 动态代理 10.1 静态代理 角色分析: 抽象角色:一般会使用

Openstack 网络服务Neutron [五]

Openstack 网络服务Neutron [五] openstack 时间:2016年11月28日 Neutron介绍 neutron是openstack重要组件之一,在以前是时候没有neutron项目 早期的时候是没有neutron,早期所使用的网络的nova-network,经过版本改变才有个neutron Openstack Networking 网络: 在实际的物理环境下,我们使用交换机或者集线器把多个计算机连接起来形成了网络.在Neutron的世界里,网络也是将多个不同的云主机连接起

五、openstack安装之Neutron篇

一.前言 在openstack中配置networking服务都是一段困惑的经历.本指南提供一步步说明如何配置Networking(neutron)和传统的网络服务(nova-network).如果你不确定使用哪种,建议尝试neutron,因为它提供了相当数量的功能和灵活性,包括各种新兴产品的插件来支持虚拟网络. 二.Networking概念 openstack Networking(neutron)管理所有虚拟网络,包括网络基础设施(VNI)和访问层方面的物理网络.它允许租户创建高级的虚拟网络拓

Ubuntu搭建Openstack平台(kilo)(五.neutron(二)网络节点与计算节点)

参考文档:http://www.aboutyun.com/thread-13116-1-1.html http://www.aboutyun.com/thread-13117-1-1.html 网络节点 一.配置参数 环境配置 vim /etc/sysctl.conf net.ipv4.ip_forward=1 net.ipv4.conf.all.rp_filter=0 net.ipv4.conf.default.rp_filter=0 使配置生效 sysctl -p 二.安装neutron组件

Ubuntu搭建Openstack平台(kilo)(五.neutron(一)控制节点)

一.neutron环境 参考文档:http://www.aboutyun.com/thread-13108-1-1.html http://docs.openstack.org/mitaka/install-guide-ubuntu/neutron-controller-install.html 1.创建neutron数据库并授权 创建 mysql -u root -p CREATE DATABASE neutron; 授权 GRANT ALL PRIVILEGES ON neutron.* T

(转载)openstack学习指南

OpenStack Hacker养成指南 朱 荣泽     |     2013. 8. 8 [toc wrapping="right"] 0 阅读指南 希望本文能够解开你心中萦绕已久的心结,假如是死结,请移步到 https://wiki.openstack.org/wiki/Main_Page 学习OpenStack其实就是学习各种Python库的过程. 把OpenStack的设计原则贴在你的墙上. https://wiki.openstack.org/wiki/BasicDesig

openstack M 版 neutron网络组件基础入门

在我们openstack学习当中,网络组件neutron无疑是令很多人很难理解的,可以说要深入理解 了neutron组件,你基本完成了openstack 60%的学习,存储方面只要不涉及到分布式,剩下的基本都比较简单了 相信很多人第一次看到这种图的时候都会被吓一跳,没错,这就是openstack  neutron组件里面涉及到的数据流程,里面涉及到的知识点很多很多 Openstack网络模型中的几个概念网络: Management Network: 管理网络,连接所有节点. External N

Openstack(Juno)中VPNaaS的配置

vpnaas配置的资料很少,官网目前参考的https://wiki.openstack.org/wiki/Neutron/VPNaaS/HowToInstall比较旧,方面配置基本没有讲 经历漫长时间的查找资料.学习,现终于配置成功了,记录下来给大家参考一下,有什么不正确的地方及时留言 1. 配置 1.1 准备 yum install openstack-neutron-vpn-agent libreswan -y vi /etc/sysctl net.ipv4.ip_forward=1 net

Neutron - Fwaas配置

Fwaas简介 FWaaS uses iptables to apply firewall policy to all Networking routers within a project.(这些iptables规则存在于router的namespace)FWaaS supports one firewall policy and logical firewall instance per project.(官方介绍,本人翻译水平有限) FWaaS is currently in techni