1. 程式人生 > >OpenStack架構----neutron元件(四)

OpenStack架構----neutron元件(四)

前言:

整個OpenStack是由控制節點,計算節點,網路節點,儲存節點四大部分組成。本篇博文將詳細講解網路節點neutron元件部署過程,整體分為兩部分:控制節點和計算節點都需要設定。

網路節點架構

網路節點僅包含Neutron服務

Neutron:負責管理私有網段與公有網段的通訊,以及管理虛擬機器網路之間的通訊/拓撲,管理虛擬機器之上的防火等等

網路節點包含三個網路埠

eth0:用於與控制節點進行通訊

eth1:用於與除了控制節點之外的計算/儲存節點之間的通訊

eth2:用於外部的虛擬機器與相應網路之間的通訊

實驗環境:


主  機 系  統
IP地址 角  色
controller CentOS7 192.168.37.128 keystone、nova、glanceneutron、ntp、mariadb、rabbitmq、memcached、etcd、apache、
compute CentOS7 192.168.37.130 nova、neutron、ntp
cinder CentOS7 192.168.37.131 cinder、ntp
實驗過程:

++controller節點neutron網路配置++

1、建立nuetron資料庫和授權

mysql -u root -p

create database neutron;

grant all privileges on neutron.* to 'neutron'@'localhost' identified by '123456';

grant all privileges on neutron.* TO 'neutron'@'%'identified by '123456';


2、建立使用者neutron

source ~/admin-openrc

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


1.png

3、把neutron使用者新增到glance使用者和專案中

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


4、建立neutron服務

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


2.png

5、建立網路服務API端點

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安裝neutron軟體包

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


7、修改配置檔案

vim  /etc/neutron/neutron.conf

[database]

//729

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


[DEFAULT]

//27

auth_strategy = keystone

//30

core_plugin = ml2             #外掛ml2

//33 不寫代表禁用其他外掛

service_plugins =

//570

transport_url = rabbit://openstack:[email protected]

//98

notify_nova_on_port_status_changes = true     #nova埠狀態通告

//102

notify_nova_on_port_data_changes = true      #埠資料通告


[keystone_authtoken]     #令牌註冊資訊

//847

auth_uri = http://controller:5000

auth_url = http://controller:35357

//898

memcached_servers = controller:11211

//1005

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = neutron

password = 123456


[nova]

//1085

auth_url = http://controller:35357

//1089

auth_type = password

//1127

project_domain_name = default

//1156

user_domain_name = default

//1069

region_name = RegionOne

//1135

project_name = service

//1163

username = nova

//1121

password = 123456


[oslo_concurrency]

//1179

lock_path = /var/lib/neutron/tmp


8、配置網路二層外掛

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


[ml2]

//136

type_drivers = flat,vlan          #flat-橋接  vlan-區域網

//141   設定空是禁用本地網路

tenant_network_types =

//145

mechanism_drivers = linuxbridge

//150

extension_drivers = port_security


[ml2_type_flat]

//186

flat_networks = provider         #橋接網路型別


[securitygroup]

//263

enable_ipset = true            #安全組


9、配置Linux網橋

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

[linux_bridge]

//157

physical_interface_mappings = provider:ens33


[vxlan]

//208

enable_vxlan = false


[securitygroup]

//193

enable_security_group = true             #開啟安全組

//188

firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver


10、配置DHCP

vim /etc/neutron/dhcp_agent.ini


//16

interface_driver = linuxbridge           #介面型別

//28

dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq

//37

enable_isolated_metadata = true


11、配置metadata

vim  /etc/neutron/metadata_agent.ini


[DEFAULT]

//22

nova_metadata_host = controller

//34

metadata_proxy_shared_secret = 123456


12、配置計算服務使用網路服務

vim /etc/nova/nova.conf        #在``[neutron]`` 部分,配置訪問引數


[neutron]

//7613

url = http://controller:9696

//7689

auth_url = http://controller:35357

//7683

auth_type = password

//7710

project_domain_name = default

//7763

user_domain_name = default

//7757

region_name = RegionOne

//7704

project_name = service

//7730

username = neutron

//7739

password = 123456

//7652

service_metadata_proxy = true          #metadata代理開啟

//7584

metadata_proxy_shared_secret = 123456     #代理的認證金鑰


13、建立服務軟連線

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


14、同步資料庫

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


15、重啟compute API服務,並開啟相關服務

systemctl restart openstack-nova-api.service

systemctl enable neutron-server.service   

systemctl enable neutron-linuxbridge-agent.service 

systemctl enable neutron-dhcp-agent.service   

systemctl enable neutron-metadata-agent.service

systemctl restart neutron-server.service   

systemctl restart neutron-linuxbridge-agent.service 

systemctl restart neutron-dhcp-agent.service   

systemctl restart neutron-metadata-agent.service


++compute節點neutron網路配置++

1、yum安裝neutron包

yum install -y openstack-neutron-linuxbridge ebtables ipset


2、配置公共元件

vim /etc/neutron/neutron.conf


[DEFAULT]

//27

auth_strategy = keystone

//570

transport_url = rabbit://openstack:[email protected]


[keystone_authtoken]

//847

auth_uri = http://controller:5000

auth_url = http://controller:35357

//898

memcached_servers = controller:11211

//1005

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = neutron

password = 123456


[oslo_concurrency]

//1180

lock_path = /var/lib/neutron/tmp


3、配置Linux網橋

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


[linux_bridge]

//157

physical_interface_mappings = provider:ens33


[vxlan]

//208

enable_vxlan = false


[securitygroup]

//193

enable_security_group = true

//188

firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver


4、配置計算節點網路服務

vim /etc/nova/nova.conf


[neutron]

//7534

url = http://controller:9696

//7610

auth_url = http://controller:35357

//7604

auth_type = password

//7631

project_domain_name = default

//7657

user_domain_name = default

//7678

region_name = RegionOne

//7625

project_name = service

//7651

username = neutron

//7660

password = 123456


5、開啟相關服務

systemctl restart openstack-nova-compute.service


systemctl enable neutron-linuxbridge-agent.service

systemctl start neutron-linuxbridge-agent.service


到此為止,neutron元件已經安裝完成,謝謝閱讀!