本帖最后由 pig2 于 2015-9-23 17:27 编辑
问题导读
1.如何创建neutron数据库?
2.如果配置都正确,但是还是产生错误,可能原因有哪些?
3.如何设置服务开机启动?
安装配置控制节点
1.配置准备
1.创建数据库完成下面内容
a.进入数据库
[mw_shl_code=bash,true]mysql -u root -p[/mw_shl_code]
b.进入neutron数据库
[mw_shl_code=bash,true]CREATE DATABASE neutron;[/mw_shl_code]
c.授权
[mw_shl_code=bash,true]GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \
IDENTIFIED BY 'NEUTRON_DBPASS';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \
IDENTIFIED BY 'NEUTRON_DBPASS';[/mw_shl_code]
d.退出
[mw_shl_code=bash,true]exit[/mw_shl_code]
2.加载环境变量
[mw_shl_code=bash,true]source admin-openrc.sh[/mw_shl_code]
3.创建认证服务,完成下面内容
a.创建neutron用户
[mw_shl_code=bash,true]openstack user create --password-prompt neutron[/mw_shl_code]
[mw_shl_code=bash,true]User Password:
Repeat User Password:
+----------+----------------------------------+
| Field | Value |
+----------+----------------------------------+
| email | None |
| enabled | True |
| id | ab67f043d9304017aaa73d692eeb4945 |
| name | neutron |
| username | neutron |
+----------+----------------------------------+[/mw_shl_code]
b.给neutron 用户添加admin角色
[mw_shl_code=bash,true] openstack role add --project service --user neutron admin[/mw_shl_code]
[mw_shl_code=bash,true]+-------+----------------------------------+
| Field | Value |
+-------+----------------------------------+
| id | cd2cb9a39e874ea69e5d4b896eb16128 |
| name | admin |
+-------+----------------------------------+[/mw_shl_code]
c.创建 neutron服务实例
[mw_shl_code=bash,true]openstack service create --name neutron \
--description "OpenStack Networking" network[/mw_shl_code]
[mw_shl_code=bash,true]+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Networking |
| enabled | True |
| id | f71529314dab4a4d8eca427e701d209e |
| name | neutron |
| type | network |
+-------------+----------------------------------+[/mw_shl_code]
4.创建网络服务 API endpoint:
[mw_shl_code=bash,true]openstack endpoint create \
--publicurl http://controller:9696 \
--adminurl http://controller:9696 \
--internalurl http://controller:9696 \
--region RegionOne \
network[/mw_shl_code]
[mw_shl_code=bash,true]+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| adminurl | http://controller:9696 |
| id | 04a7d3c1de784099aaba83a8a74100b3 |
| internalurl | http://controller:9696 |
| publicurl | http://controller:9696 |
| region | RegionOne |
| service_id | f71529314dab4a4d8eca427e701d209e |
| service_name | neutron |
| service_type | network |
+--------------+----------------------------------+[/mw_shl_code]
2.安装网络组件
[mw_shl_code=bash,true] yum install openstack-neutron openstack-neutron-ml2 python-neutronclient which[/mw_shl_code]
3.配置网络服务组件
编辑文件/etc/neutron/neutron.conf,完成下面内容
a.在[database] 部分,配置数据库连接
[mw_shl_code=bash,true][database]
...
connection = mysql://neutron:NEUTRON_DBPASS@controller/neutron[/mw_shl_code]
b.在[DEFAULT] 和 [oslo_messaging_rabbit] 部分,配置RabbitMQ 消息队列访问
[mw_shl_code=bash,true][DEFAULT]
...
rpc_backend = rabbit
[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS[/mw_shl_code]
c.在 [DEFAULT] 和 [keystone_authtoken] 部分,配置认证访问
[mw_shl_code=bash,true][DEFAULT]
...
auth_strategy = keystone
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = NEUTRON_PASS[/mw_shl_code]
在 [keystone_authtoken] 部分,注释掉其他任何选项
d.在[DEFAULT]部分,启用 (ML2) 插件,路由服务, 和 overlapping IP addresses:
[mw_shl_code=bash,true][DEFAULT]
...
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True[/mw_shl_code]
e.在 [DEFAULT] 和 [nova] 部分,配置网络通知计算网络拓扑结构的变化:
[mw_shl_code=bash,true][DEFAULT]
...
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
nova_url = http://controller:8774/v2
[nova]
...
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = nova
password = NOVA_PASS[/mw_shl_code]
NOVA_PASS 替换为自己修改的内容
f.启用详细信息日志记录
[mw_shl_code=bash,true][DEFAULT]
...
verbose = True[/mw_shl_code]
4.配置 (ML2) plug-in插件
编辑文件 /etc/neutron/plugins/ml2/ml2_conf.ini完成下面内容
a.在[ml2]部分,启用 flat, VLAN, generic routing encapsulation (GRE), 和 virtual extensible LAN (VXLAN),网络类型驱动, GRE 租户网络, 和 OVS mechanism 驱动:
[mw_shl_code=bash,true][ml2]
...
type_drivers = flat,vlan,gre,vxlan
tenant_network_types = gre
mechanism_drivers = openvswitch[/mw_shl_code]
警告:一旦配置ML2插件,改变type_drivers的值,将会导致数据库不一致
b.在 [ml2_type_gre] 部分,配置tunnel identifier (id) 范围:
[mw_shl_code=bash,true][ml2_type_gre]
...
tunnel_id_ranges = 1:1000[/mw_shl_code]
c.在 [securitygroup] 部分,启用安全组, ipset, 和 配置 OVS iptables防火墙驱动:
[mw_shl_code=bash,true][securitygroup]
...
enable_security_group = True
enable_ipset = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver[/mw_shl_code]
配置计算使用网络
在控制节点,编辑文件 /etc/nova/nova.conf完成下面内容
a.在 [DEFAULT]部分,配置API和驱动
[mw_shl_code=bash,true][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[/mw_shl_code]
b.在 [neutron]部分,配置访问参数
[mw_shl_code=bash,true][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_PASS[/mw_shl_code]
NEUTRON_PASS 替换为自己设置密码
完成安装
1.网络服务初始化脚本
[mw_shl_code=bash,true]ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini[/mw_shl_code]
2.同步数据库
[mw_shl_code=bash,true]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[/mw_shl_code]
3.重启计算服务
[mw_shl_code=bash,true]systemctl restart openstack-nova-api.service openstack-nova-scheduler.service \
openstack-nova-conductor.service[/mw_shl_code]
4.启动网络服务【开机启动】
[mw_shl_code=bash,true]systemctl enable neutron-server.service
systemctl start neutron-server.service[/mw_shl_code]
验证安装
1.加载环境变量
[mw_shl_code=bash,true] source admin-openrc.sh[/mw_shl_code]
2.列出下列服务
[mw_shl_code=bash,true] neutron ext-list
+-----------------------+-----------------------------------------------+
| alias | name |
+-----------------------+-----------------------------------------------+
| security-group | security-group |
| l3_agent_scheduler | L3 Agent Scheduler |
| ext-gw-mode | Neutron L3 Configurable external gateway mode |
| binding | Port Binding |
| provider | Provider Network |
| agent | agent |
| quotas | Quota management support |
| dhcp_agent_scheduler | DHCP Agent Scheduler |
| l3-ha | HA Router extension |
| multi-provider | Multi Provider Network |
| external-net | Neutron external network |
| router | Neutron L3 Router |
| allowed-address-pairs | Allowed Address Pairs |
| extraroute | Neutron Extra Route |
| extra_dhcp_opt | Neutron Extra DHCP opts |
| dvr | Distributed Virtual Router |
+-----------------------+-----------------------------------------------+[/mw_shl_code]
相关篇章
openstack【Kilo】入门 【准备篇】一:整体介绍【centos】
http://www.aboutyun.com/thread-15205-1-1.html
openstack【Kilo】入门 【准备篇】二:检测网络互通性【centos】
http://www.aboutyun.com/thread-15206-1-1.html
openstack【Kilo】入门 【准备篇】三:NTP安装【centos】
http://www.aboutyun.com/thread-15207-1-1.html
openstack【Kilo】入门 【准备篇】四:openstack包【centos】
http://www.aboutyun.com/thread-15210-1-1.html
openstack【Kilo】入门 【准备篇】五:mysql及rabbitmq安装【centos】
http://www.aboutyun.com/thread-15213-1-1.html
openstack【Kilo】入门 【keystone篇】六:keystone安装配置【centos】
http://www.aboutyun.com/thread-15214-1-1.html
openstack【Kilo】入门 【keystone篇】七:创建服务实例和API endpoint【centos】
http://www.aboutyun.com/thread-15215-1-1.html
openstack【Kilo】入门 【keystone篇】八:创建租户, 用户, 和角色【centos】
http://www.aboutyun.com/thread-15216-1-1.html
openstack【Kilo】入门 【keystone篇】九:验证keystone安装【centos】
http://www.aboutyun.com/thread-15233-1-1.html
openstack【Kilo】入门 【keystone篇】十:创建openstack客户端脚本【centos】
http://www.aboutyun.com/thread-15234-1-1.html
openstack【Kilo】入门 【glance篇】十一:安装配置glance【centos】
http://www.aboutyun.com/thread-15242-1-1.html
openstack【Kilo】入门 【glance篇】十二:glance安装验证【centos】
http://www.aboutyun.com/thread-15243-1-1.html
openstack【Kilo】入门 【nova篇】十三:nova安装配置1:控制节点【centos】
http://www.aboutyun.com/thread-15258-1-1.html
openstack【Kilo】入门 【nova篇】十四:nova安装配置2:计算节点【centos】
http://www.aboutyun.com/thread-15259-1-1.html
openstack【Kilo】入门 【neutron篇】十五:neutron安装配置:控制节点【centos】
http://www.aboutyun.com/thread-15260-1-1.html
openstack【Kilo】入门 【neutron篇】十六:neutron安装配置:网络节点【centos】
http://www.aboutyun.com/thread-15272-1-1.html
openstack【Kilo】入门 【neutron篇】十七:neutron安装配置:计算节点【centos】
http://www.aboutyun.com/thread-15330-1-1.html
openstack【Kilo】入门 【neutron篇】十八:实例化网络【centos】
http://www.aboutyun.com/thread-15342-1-1.html
openstack【Kilo】入门 【neutron篇】十九:dasboard安装配置【centos】
http://www.aboutyun.com/thread-15352-1-1.html
openstack【Kilo】入门 【neutron篇】二十:创建实例(neutron)【centos】
http://www.aboutyun.com/thread-15356-1-1.html
|