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 list

#openstack network agent list

創建br-ex網橋,連接接口

#ovs-vsctl add-br br-ex

#ovs-vsctl add-port br-ex ens38
綁第三塊網卡

#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

#neutron agent-list

#systemctl stop openvswitch neutron-openvswitch-agent#

查看

#openstack network list

在這裏插入圖片描述
#openstack network delete 673b3523-3820-4849-8ee7-e359aa17c3b5

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章