1. 程式人生 > >openstack搭建之-neutron配置(19)

openstack搭建之-neutron配置(19)

搭建 ridge esc outer neutron notify 安裝 scrip set

一、base節點設置

mysql -u root -proot

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

二、 ctrl節點設置

#運行環境變量

. admin-openrc

#創建neutron用戶並添加角色

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

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

#創建neutron服務並設置endpoint

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

openstack endpoint create --region RegionOne network public http://ctrl.test.com:9696

openstack endpoint create --region RegionOne network internal http://ctrl.test.com:9696

openstack endpoint create --region RegionOne network admin http://ctrl.test.com:9696

#安裝neutron軟件

yum install \

openstack-neutron \

openstack-neutron-ml2 \

openstack-neutron-linuxbridge \

ebtables -y

#編輯neutron配置文件

vim /etc/neutron/neutron.conf

[database]
connection = mysql+pymysql://neutron:[email protected]/neutron
[DEFAULT] core_plugin = ml2 service_plugins = #service_plugins = router #allow_overlapping_ips = true transport_url = rabbit://openstack:[email protected] auth_strategy = keystone notify_nova_on_port_status_changes = true notify_nova_on_port_data_changes = true [keystone_authtoken] auth_uri = http://ctrl.test.com:5000 auth_url = http://ctrl.test.com:35357 memcached_servers = base.test.com:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = NEUTRON_PASS [nova] auth_url = http://ctrl.test.com:35357 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = nova password = NOVA_PASS [oslo_concurrency] lock_path = /var/lib/neutron/tmp

#編輯ml2配置文件

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

[ml2]
type_drivers = flat,vlan,gre,vxlan,geneve
#type_drivers = flat,vlan,vxlan
tenant_network_types = flat,vlan,gre,vxlan,geneve
#tenant_network_types = vxlan
mechanism_drivers = linuxbridge
#mechanism_drivers = linuxbridge,l2population
extension_drivers = port_security

[ml2_type_flat]
flat_networks = provider

[securitygroup]
enable_ipset = true

#[ml2_type_vxlan]
#vni_ranges = 1:1000

#編輯linuxbridge_agent配置文件

vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini

[linux_bridge]
physical_interface_mappings = provider:eth1

[vxlan]
enable_vxlan = false
#enable_vxlan = true
#local_ip = 172.16.2.52
#l2_population = true

[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

#編輯l3配置文件

#vim /etc/neutron/l3_agent.ini

[DEFAULT]
#interface_driver = linuxbridge

#編輯dhcp配置文件

vim /etc/neutron/dhcp_agent.ini

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

#編輯metadata配置文件

vim /etc/neutron/metadata_agent.ini

[DEFAULT]
nova_metadata_host =ctrl.test.com
metadata_proxy_shared_secret = METADATA_SECRET

#編輯Nova配置文件

vim /etc/nova/nova.conf

[neutron]
url = http://ctrl.test.com:9696
auth_url = http://ctrl.test.com: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

#創建軟連接

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

#初始化數據庫

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 restart neutron-server.service \

neutron-linuxbridge-agent.service \

neutron-dhcp-agent.service \

neutron-metadata-agent.service

systemctl enable neutron-server.service \

neutron-linuxbridge-agent.service \

neutron-dhcp-agent.service \

neutron-metadata-agent.service

#systemctl restart neutron-l3-agent.service

#systemctl enable neutron-l3-agent.service

#驗證(計算節點配置完成再驗證)

. admin-openrc

openstack extension list --network

openstack network agent list

三、 com計算節點配置

#安裝軟件

yum install openstack-neutron-linuxbridge ebtables ipset -y

#編輯neutron配置文件

vim /etc/neutron/neutron.conf

[DEFAULT]
transport_url = rabbit://openstack:[email protected]
auth_strategy = keystone

[keystone_authtoken]
auth_uri = http://ctrl.test.com:5000
auth_url = http://ctrl.test.com:35357
memcached_servers = base.test.com:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = NEUTRON_PASS

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

#編輯橋接配置文件

vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini

[linux_bridge]
physical_interface_mappings = provider:eth0
 
[vxlan]
enable_vxlan = false
#enable_vxlan = true
#local_ip = 172.16.2.53
#l2_population = true

[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

#編輯Nova配置文件

vim /etc/nova/nova.conf

[neutron]
url = http://ctrl.test.com:9696
auth_url = http://ctrl.test.com:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = NEUTRON_PASS

#開啟服務

systemctl restart openstack-nova-compute.service

systemctl restart neutron-linuxbridge-agent.service

systemctl enable neutron-linuxbridge-agent.service

註:配置文件中註釋部分配置文件為創建L3路由網絡使用的配置信息。未註釋的配置信息為交換機網絡。後續創建網絡根據需要進行開啟。註意,相同項保留一項即可。

openstack搭建之-neutron配置(19)