Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

OpenStack Kilo 多節點部署(五):計算節點上的 Neutron 配置

聲明:這是 Kilo 版本多節點安裝系列的一部分。網路上可用的 Kilo 教程不多,且多數照著做仍會失敗,因此把自己的過程記錄下來。OpenStack 的安裝環節多、環境差異大,本文無法保證換一台機器也能一次成功,難免有疏漏之處。以下均在虛擬機環境完成,實機部署時位址與介面名稱需自行替換。

轉載請保留出處。作者:張某人ER。

在計算節點上安裝 Neutron

進行設定

vim /etc/sysctl.conf

net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1

生效:

sysctl -p

關閉 rp_filter 是因為採用 overlay 網路時,反向路徑過濾會把虛擬機的封包丟掉。

安裝套件

yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch

修改 neutron.conf

vim /etc/neutron/neutron.conf
rpc_backend = rabbit
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = openstack
auth_strategy = keystone

[keystone_authtoken]
auth_uri = https://controller:5000
auth_url = https://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = neutron

[default]
verbose = True
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True

修改 ml2_conf.ini

vim /etc/neutron/plugins/ml2/ml2_conf.ini
type_drivers = flat,vlan,gre,vxlan
tenant_network_types = gre
mechanism_drivers = openvswitch
tunnel_id_ranges = 1:1000
enable_security_group = True
enable_ipset = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver

[ovs]
local_ip = INSTANCE_TUNNELS_INTERFACE_IP_ADDRESS
[agent]
tunnel_types = gre

local_ip 要填本節點上隧道介面的位址,不能照抄。

啟動 Open vSwitch

systemctl enable openvswitch.service
systemctl start openvswitch.service

修改 nova.conf

vim /etc/nova/nova.conf
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

[neutron]
url = https://controller:9696
auth_strategy = keystone
admin_auth_url = https://controller:35357/v2.0
admin_tenant_name = service
admin_username = neutron
admin_password = neutron

修正 plugin 連結與 service 檔

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

cp /usr/lib/systemd/system/neutron-openvswitch-agent.service \
   /usr/lib/systemd/system/neutron-openvswitch-agent.service.orig
sed -i 's,plugins/openvswitch/ovs_neutron_plugin.ini,plugin.ini,g' \
   /usr/lib/systemd/system/neutron-openvswitch-agent.service

Kilo 的 service 檔仍指向舊的 plugin 路徑,不修正的話 agent 會找不到設定檔而啟動失敗。

重新啟動相關服務

systemctl restart openstack-nova-compute.service
systemctl enable neutron-openvswitch-agent.service
systemctl start neutron-openvswitch-agent.service

回到控制節點驗證

source admin-openrc.sh
neutron agent-list

如果能看到本節點的 openvswitch agent 且 Alive 為 :-) ,就可以著手建立初始網路了。

本教程至此結束,後續文章會再整理安裝過程中遇到的各類問題。

Copyright © Linux教程網 All Rights Reserved