|NO.Z.00019|——————————|^^^^ 部署 ^^^^|——|OpenStack&元件.V06|--------------------------|OpenStack-network|Open vSwitch(OVS)配置.V02|
阿新 • • 發佈:2022-03-27
[CloudVirtualiZation:OpenStack&元件.V06] [Applications.CloudVirtualiZation] [|OpenStack|OpenStack.neutron|網路基礎概念|neutron元件架構|構建neutron|配置network節點|建立網路]
一、安裝並配置compute1節點
### --- 安裝並配置compute1節點(若是你部署了多個compute節點的情況,重複去配置,方案是一樣的) ~~~ 配置先決條件 ~~~ 安裝網路元件 ~~~ 配置網路通用組建 ~~~ 配置Modular Layer2(ML2)plug-in ~~~ 配置Open VSwitch(OVS)service ~~~ 配置計算服務使用網路 ~~~ 完成安裝 ~~~ 驗證
一、配置先決條件compute1節點配置
### --- 編輯/etc/sysctl.conf檔案,使其包含下列引數:修改核心引數
[root@compute1 ~]# vim /etc/sysctl.conf
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
二、安裝網路元件### --- 使/etc/sysctl.conf檔案中更改生效。 重新整理一下核心引數 [root@compute1 ~]# sysctl -p net.ipv4.conf.all.rp_filter = 0 net.ipv4.conf.default.rp_filter = 0
三、配置網路通用元件[root@compute1 ~]# yum install openstack-neutron-ml2 openstack-neutron-openvswitch Installed: openstack-neutron-ml2.noarch 0:2014.2-5.el7.centos openstack-neutron-openvswitch.noarch 0:2014.2-5.el7.centos Dependency Installed: conntrack-tools.x86_64 0:1.4.2-3.el7 crudini.noarch 0:0.4-1.el7 dnsmasq-utils.x86_64 0:2.66-12.el7 ipset.x86_64 0:6.19-4.el7 ipset-libs.x86_64 0:6.19-4.el7 libnetfilter_cthelper.x86_64 0:1.0.0-4.el7 libnetfilter_cttimeout.x86_64 0:1.0.0-2.el7 libnetfilter_queue.x86_64 0:1.0.2-2.el7 openstack-neutron.noarch 0:2014.2-5.el7.centos openstack-utils.noarch 0:2014.1-3.el7.centos.1 openvswitch.x86_64 0:2.1.2-2.el7.centos.1 python-jsonrpclib.noarch 0:0.1.3-1.el7 python-neutron.noarch 0:2014.2-5.el7.centos Complete!
### --- 編輯/etc/neutron/neutron.conf檔案並完成下列操作:
[root@compute1 ~]# vim /etc/neutron/neutron.conf
# 編輯[database]小節,註釋左右connection配置項,因為計算節點不能直接連線資料庫
# 編輯[DEFAULT]小節,配置RabbitMQ訊息代理訪問:
[DEFAULT]
......
rpc_backend=rabbit
rabbit_host=controller.nice.com
rabbit_password=guest
# 編輯[DEFAULT]和[keystone_authtoken]小節,配置認證服務訪問:
[DEFAULT]
......
auth_strategy=keystone
[keystone_authtoken]
......
auth_uri=http://controller.nice.com:5000/v2.0
identity_uri=http://controller.nice.com:35357
admin_tenant_name=service
admin_user=neutron
admin_password=NEUTRON_PASS
# 編輯[DEFAULT]小節,啟用Modular Layer2(ML2),路由服務和重疊ip地址功能:
[DEFAULT]
......
core_plugin=ml2
service_plugins=router
allow_overlapping_ips=True
# (可選)在[DEFAULT]小節中配置詳細日誌輸出,方便排錯。
[DEFAULT]
......
verbose=True # 開啟日誌
四、配置Modular Layer2(ML2)plug-in
### --- 編輯/etc/neutron/plugins/ml2/ml2_conf.ini檔案並完成下列操作:
[root@compute1 ~]# vim /etc/neutron/plugins/ml2/ml2_conf.ini
# 編輯[ml2]小節,啟用flat和generic routing encapsulation(GRE)網路型別驅動,GRE租戶網路和OVS機制驅動。
[ml2]
......
type_drivers=flat,gre
tenant_network_types=gre
mechanism_drivers=openvswitch
# 編輯[ml2_type_gre]小節,配置隧道識別符號(id)範圍:
[ml2_type_gre]
......
tunnel_id_ranges=1:1000
# 編輯[securitygroup]小節,啟用安裝組,ipset並配置OVS iptables防火牆驅動:
[securitygroup]
......
enable_security_group=True
enable_ipset=True
firewall_driver=neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
# 編輯[OVS]小節,配置Open VSwitch(OVS)agent:
[OVS]
......
[OVS]
[OVS]
local_ip=172.16.0.10 # 例項網路的IP地址
tunnel_type=gre
enable_tunneling=True
五、配置Open VSwitch(OVS)service
### --- 啟動OVS服務並設定開機自動啟動:
[root@compute1 ~]# systemctl enable openvswitch.service
ln -s '/usr/lib/systemd/system/openvswitch.service' '/etc/systemd/system/multi-user.target.wants/openvswitch.service'
[root@compute1 ~]# systemctl start openvswitch.service
[root@compute1 ~]# systemctl status openvswitch.service
六、配置計算服務使用的網路
### --- 編輯/etc/nova/nova.conf檔案並完成下列操作:
[root@compute1 ~]# vim /etc/nova/nova.conf
# 編輯[DEFAULT]小節,配置API介面和驅動:
[DEFAULT]
......
network_api_class=nova.network.neutronv2.api.API # neutron提供的API介面
security_group_api=neutron # neutron的安全組開啟
linuxnet_interface_driver=nova.network.linux_net.LinuxOVSInterfaceDriver # 配置網絡卡驅動
firewall_driver=nova.virt.firewall.NoopFirewallDriver # 防火牆配置
# 編輯[neutron]小節,配置訪問引數: # 配置neutron的相關連線引數
[neutron]
......
url=http://controller.nice.com:9696 # 訪問端點,訪問neutron的端點,內部訪問的端點
auth_strategy=keystone # 認證方式
admin_auth_url=http://controller.nice.com:35357/v2.0 # 管理員的訪問端點
admin_tenant_name=service # 租戶名稱
admin_username=neutron # 管理員使用者名稱
admin_password=NEUTRON_PASS # 管理員密碼
七、完成安裝:
### --- 建立網路服務初始化指令碼的符號連線,
[root@compute1 ~]# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
[root@compute1 ~]# cp /usr/lib/systemd/system/neutron-openvswitch-agent.service /usr/lib/systemd/system/neutron-openvswitch-agent.service.orig
[root@compute1 ~]# ll /usr/lib/systemd/system/neutron-openvswitch-agent.service
-rw-r--r-- 1 root root 437 Oct 30 2014 /usr/lib/systemd/system/neutron-openvswitch-agent.service
### --- 修改網路型別
[root@compute1 ~]# sed -i 's,plugins/openvswitch/ovs_neutron_plugin.ini,plugin.ini,g' /usr/lib/systemd/system/neutron-openvswitch-agent.service
### --- 重啟計算服務:
[root@compute1 ~]# systemctl restart openstack-nova-compute.service
### --- 啟動OVS代理服務並設定開機自動啟動:
[root@compute1 ~]# systemctl enable neutron-openvswitch-agent.service
ln -s '/usr/lib/systemd/system/neutron-openvswitch-agent.service' '/etc/systemd/system/multi-user.target.wants/neutron-openvswitch-agent.service'
[root@compute1 ~]# systemctl start neutron-openvswitch-agent.service
[root@compute1 ~]# systemctl status neutron-openvswitch-agent.service
八、驗證(在controller)節點執行下列命令### --- 執行admin環境變數指令碼
[root@controller ~]# source admin-openrc.sh
### --- 列出neutron代理,確認啟動neutron agents成功。
[root@controller ~]# neutron agent-list
+--------------------------------------+--------------------+-------------------+-------+----------------+---------------------------+
| id | agent_type | host | alive | admin_state_up | binary |
+--------------------------------------+--------------------+-------------------+-------+----------------+---------------------------+
| 25122ee3-54d0-4013-9e32-c752bb444874 | Metadata agent | network.nice.com | :-) | True | neutron-metadata-agent |
| 29e66a01-d01a-4bdb-8231-9adcf062b29b | Open vSwitch agent | network.nice.com | :-) | True | neutron-openvswitch-agent |
| 36e27e39-8e6b-4673-914b-ca3dd6ebf5ec | L3 agent | network.nice.com | :-) | True | neutron-l3-agent |
| 82964596-8d90-4001-b52a-6aa1e183c92a | DHCP agent | network.nice.com | :-) | True | neutron-dhcp-agent |
| a6cdf9f1-426a-4614-ab81-659168f846cf | Open vSwitch agent | compute1.nice.com | :-) | True | neutron-openvswitch-agent |
+--------------------------------------+--------------------+-------------------+-------+----------------+---------------------------+
===============================END===============================
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart ——W.S.Landor
來自為知筆記(Wiz)