Neutron 概念:
傳統的網絡管理方式很大程度上依賴于管理者手工配置和維護各種網絡硬體裝置;而雲環境下的網絡已經變得非常複雜,特别是在多租戶場景裡,使用者随時都可能需要建立、修改和删除網絡,網絡的連通性和隔離不已經太可能通過手工配置來保證了。
如何快速響應業務的需求對網絡管理提出了更高的要求。傳統的網絡管理方式已經很難勝任這項工作,而“軟體定義網絡(software-defined networking, SDN)”所具有的靈活性和自動化優勢使其成為雲時代網絡管理的主流。
Neutron 的設計目标是實作“網絡即服務(Networking as a Service)”。為了達到這一目标,在設計上遵循了基于 SDN 實作網絡虛拟化的原則,在實作上充分利用了 Linux 系統上的各種網絡相關的技術。
SDN 模式服務— NeutronSDN( 軟體定義網絡 ), 通過使用它,網絡管理者和雲計算操作員可以通過程式來動态定義虛拟網絡裝置。Openstack 網絡中的 SDN 元件就是 Quantum.但因為版權問題而改名為Neutron 。
Neutron 架構 :
Neutron 由如下元件構成:
Neutron Server
對外提供 OpenStack 網絡 API,接收請求,并調用 Plugin 處理請求。
Plugin
處理 Neutron Server 發來的請求,維護 OpenStack 邏輯網絡狀态, 并調用 Agent 處理請求。
Agent
處理 Plugin 的請求,負責在 network provider 上真正實作各種網絡功能。
network provider
提供網絡服務的虛拟或實體網絡裝置,例如 Linux Bridge,Open vSwitch 或者其他支援 Neutron 的實體交換機。
Queue
Neutron Server,Plugin 和 Agent 之間通過 Messaging Queue 通信和調用。
Database
存放 OpenStack 的網絡狀态資訊,包括 Network, Subnet, Port, Router 等。
Neutron 架構非常靈活,層次較多,目的是:
1、為了支援各種現有或者将來會出現的優秀網絡技術。
2、支援分布式部署,獲得足夠的擴充性。Neutron 架構非常靈活,層次較多。
Neutron 架構架構總結:
Neutron 通過 plugin 和 agent 提供的網絡服務。
plugin 位于 Neutron server,包括 core plugin 和 service plugin。
agent 位于各個節點,負責實作網絡服務。
core plugin 提供 L2 功能,ML2 是推薦的 plugin。
使用最廣泛的 L2 agent 是 linux bridage 和 open vswitch。
service plugin 和 agent 提供擴充功能,包括 dhcp, routing, load balance, firewall, vpn 等。
環境準備
1、三台機器:主機名:lichaohost1 (控制節點)叢集網ip:192.168.206.137 租戶網ip: 192.168.206.142 外網ip:192.168.206.143
主機名:lichaohost2 (計算節點)叢集網ip:192.168.206.138 租戶網ip: 192.168.206.144
主機名:lichaohost3 (儲存節點) 叢集網ip :192.168.206.139
2、控制節點端三塊網卡:
ens33: 叢集網 (元件互相通信)
ens37:租戶網 (執行個體互相通信)
ens38:外網
3、計算節點兩塊網卡
ens33:叢集網
ens37:租戶網
4、儲存節點一塊網卡
ens33:叢集網
5、每台機器最少4G記憶體
6、靜态域名解析
7、免密登入
openstacke ocata版 官方網站:https://docs.openstack.org/ocata/index.html
部署方案
控制節點:部署的服務包括:neutron server, core plugin 的 agent 和 service plugin 的 agent。
計算節點:部署 core plugin 的agent,負責提供二層網絡功能。
#Open vSwitch: 網絡拓撲圖
Open vSwitch 中的網絡裝置:
br-ex:連接配接外部(external)網絡的網橋。
br-int:內建(integration)網橋,所有 instance 的虛拟網卡和其他虛拟網絡裝置都将連接配接到該網橋。
br-tun:隧道(tunnel)網橋,基于隧道技術的 VxLAN 和 GRE 網絡将使用該網橋進行通信。
tap interface:命名為 tapXXXX。
linux bridge:命名為 qbrXXXX。
veth pair:命名為 qvbXXXX, qvoXXXX
OVS integration bridge:命名為 br-int。
OVS patch ports:命名為 int-br-ethX 和 phy-br-ethX(X 為 interface 的序号)。
OVS provider bridge:命名為 br-ethX(X 為 interface 的序号)。
實體 interface:命名為 ethX(X 為 interface 的序号)。
OVS tunnel bridge:命名為 br-tun。
開始部署Neutron網絡服務
1、 控制節點:登入資料庫并建立資料庫
mysql -u root -p
CREATE DATABASE neutron;
2、控制節點:授予對neutron資料庫的正确通路權
# GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'NEUTRON_DBPASS';
# GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'NEUTRON_DBPASS';
3、控制節點:宣告環境變量
. openrc 或者 source openrc
4、控制節點:添加neutron 使用者
openstack user create --domain default --password=neutron neutron
5、控制節點:将admin角色添加到server項目的neutron使用者中
openstack role add --project service --user neutron admin
6、控制節點:建立neutron服務實體
openstack service create --name neutron --description "OpenStack Networking" network
7、控制節點:建立服務API端點
# openstack endpoint create --region RegionOne network public http://lichaohost1:9696
# openstack endpoint create --region RegionOne network internal http://lichaohost1:9696
# openstack endpoint create --region RegionOne network admin http://lichaohost1:9696
8、控制節點:安裝服務
yum install openstack-neutron openstack-neutron-ml2 openvswitch openstack-neutron-openvswitch ebtables -y
9、控制節點:編輯 /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:[email protected]
[agent]
[cors]
[cors.subdomain]
[database]
connection = mysql+pymysql://neutron:[email protected]/neutron
[keystone_authtoken]
auth_uri = http://lichaohost1:5000
auth_url = http://lichaohost1:35357
memcached_servers = lichaohost1: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://lichaohost1: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]
View Code
#
10、控制節點:編輯 /etc/neutron/plugins/ml2/ml2_conf.ini
#備份
#編輯内容如下
[DEFAULT]
[ml2]
type_drivers = flat,vxlan
tenant_network_types = vxlan
mechanism_drivers = openvswitch,l2population
extension_drivers = port_security
[ml2_type_flat]
[ml2_type_geneve]
[ml2_type_gre]
[ml2_type_vlan]
[ml2_type_vxlan]
vni_ranges = 1:1000
[securitygroup]
enable_ipset = true
11、控制節點:編輯 /etc/neutron/plugins/ml2/openvswitch_agent.ini
#備份
#編輯内容如下
[DEFAULT]
[agent]
tunnel_types = vxlan
l2_population = True
[ovs]
tunnel_bridge = br-tun
local_ip = 192.168.206.142
bridge_mappings =
[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = true
[xenapi]
12、控制節點:編輯 /etc/neutron/l3_agent.ini
#備份
#編輯内容如下:
[DEFAULT]
interface_driver = openvswitch
external_network_bridge = br-ex
[agent]
[ovs]
13、控制節點:編輯 /etc/neutron/dhcp_agent.ini
#備份
#編輯内容如下:
[DEFAULT]
interface_driver = openvswitch
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true
[agent]
[ovs]
14、控制節點:編輯 /etc/neutron/metadata_agent.ini
#備份
#編輯内容如下
[DEFAULT]
nova_metadata_ip = lichaohost1
metadata_proxy_shared_secret = METADATA_SECRET
[agent]
[cache]
15、控制節點 計算節點:編輯 /etc/nova/nova.conf
添加以下内容
[neutron]
url = http://lichaohost1:9696
auth_url = http://lichaohost1: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
# 計算節點:
16、控制節點:建立軟連接配接
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
17、控制節點:同步資料庫
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
18、控制節點:重新啟動openstack-nova-api.service
systemctl restart openstack-nova-api.service
19、控制節點:啟動neutron 相關服務并設定開機自啟
# systemctl start neutron-server.service neutron-dhcp-agent.service openvswitch neutron-openvswitch-agent neutron-metadata-agent.service
# systemctl enable neutron-server.service neutron-dhcp-agent.service openvswitch neutron-openvswitch-agent neutron-metadata-agent.service
20、控制節點:添加 br-ex網橋
ovs-vsctl add-br br-ex
21、控制節點:網橋關聯外網網卡 (添加個端口)
ovs-vsctl add-port br-ex ens38
22、控制節點:檢視網橋
ovs-vsctl show
23、控制節點:開啟 neutron-l3-agent.service 并設定開機自啟
# systemctl start neutron-l3-agent.service
# systemctl enable neutron-l3-agent.service
24、控制節點: 檢視網絡服務狀态
openstack network agent list
25、計算節點: 安裝相關服務
yum install openvswitch openstack-neutron-openvswitch ebtables ipset -y
26、計算節點: 編輯 /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:[email protected]
[agent]
[cors]
[cors.subdomain]
[database]
#connection = mysql+pymysql://neutron:[email protected]/neutron
[keystone_authtoken]
auth_uri = http://lichaohost1:5000
auth_url = http://lichaohost1:35357
memcached_servers = lichaohost1: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://lichaohost1: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]
27、計算節點:編輯 /etc/neutron/plugins/ml2/openvswitch_agent.ini
#備份
#編輯内容如下
[DEFAULT]
[agent]
tunnel_types = vxlan
l2_population = True
[ovs]
tunnel_bridge = br-tun
local_ip = 192.168.206.144
bridge_mappings =
[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = true
[xenapi]
28、計算節點:編輯 /etc/nova/nova.conf
29、計算節點: 啟動nova 服務
systemctl restart openstack-nova-compute.service
30、計算節點:啟動neutron 服務并設定開機自啟
systemctl start openvswitch neutron-openvswitch-agent
systemctl enable openvswitch neutron-openvswitch-agent
31、控制節點:檢視網絡服務狀态
openstack network agent list
第二個計算節點Neutron 服務配置完成
轉載于:https://www.cnblogs.com/myxxjie/p/11047946.html