安裝和配置控制器節(jié)點(diǎn)
參考安裝網(wǎng)站
https://docs.openstack.org/neutron/stein/install/controller-install-rdo.html
創(chuàng)建neutron數(shù)據(jù)庫(kù):
[root@mysql ~]# mysql -uroot -p123456
MariaDB [(none)]> CREATE DATABASE neutron;
授予對(duì)neutron數(shù)據(jù)庫(kù)的適當(dāng)訪問權(quán)限,NEUTRON_DBPASS并用合適的密碼代替 :
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'neutron123';
測(cè)試連接
[root@controller1 ~]# mysql -uneutron -pneutron123 -h 192.168.200.105
創(chuàng)建neutron用戶:
[root@controller1 ~]# source scripts/admin-stein.sh
[root@controller1 ~]# openstack user create --domain default --password-prompt neutron
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | c12058276278430fbf36271c39c4e356 |
| enabled | True |
| id | d6c4c7bda1e94cfdab641fba05efe3c8 |
| name | neutron |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
admin向neutron用戶添加角色:
[root@controller1 ~]# openstack role add --project service --user neutron admin
創(chuàng)建neutron服務(wù)實(shí)體:
[root@controller1 ~]# openstack service create --name neutron --description "OpenStack Networking" network
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Networking |
| enabled | True |
| id | 2eada1d5feff42ffb1ebf23f2c928e58 |
| name | neutron |
| type | network |
創(chuàng)建網(wǎng)絡(luò)服務(wù)API端點(diǎn):
[root@controller1 ~]# openstack endpoint create --region RegionOne network public http://openstack-vip.wyh.net:9696
[root@controller1 ~]# openstack endpoint create --region RegionOne network internal http://openstack-vip.wyh.net:9696
[root@controller1 ~]# openstack endpoint create --region RegionOne network admin http://openstack-vip.wyh.net:9696
配置橋接網(wǎng)絡(luò)
參考網(wǎng)站https://docs.openstack.org/neutron/stein/install/controller-install-option1-rdo.html
## 聯(lián)網(wǎng)選項(xiàng)1:提供商網(wǎng)絡(luò)
安裝的組件
[](https://docs.openstack.org/neutron/stein/install/controller-install-rdo.html)
[root@controller1 ~]# yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -y
編輯/etc/neutron/neutron.conf文件并完成以下操作:
在該[database]部分中,配置數(shù)據(jù)庫(kù)訪問
[database]
connection = mysql+pymysql://neutron:neutron123@openstack-vip.wyh.net/neutron
在該[DEFAULT]部分中,啟用模塊化第2層(ML2)插件并禁用其他插件:
[DEFAULT]
core_plugin = ml2
service_plugins =
在該[DEFAULT]部分中,配置RabbitMQ 消息隊(duì)列訪問:
transport_url = rabbit://openstack:openstack123@openstack-vip.wyh.net
auth_strategy = keystone
在[DEFAULT]和[keystone_authtoken]部分中,配置身份服務(wù)訪問:
www_authenticate_uri = http://openstack-vip.wyh.net:5000
auth_url = http://openstack-vip.wyh.net:5000
memcached_servers = openstack-vip.wyh.net:11211
auth_type = password
project_domain_name = openstack-vip.wyh.net
user_domain_name = openstack-vip.wyh.net
project_name = service
username = neutron
password = neutron
在[DEFAULT]和[nova]部分中,將網(wǎng)絡(luò)配置為通知Compute網(wǎng)絡(luò)拓?fù)涓模?
[DEFAULT]
# ...
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
把nova配置到最后
[nova]
auth_url = http://openstack-vip.wyh.net:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = nova
在該[oslo_concurrency]部分中,配置鎖定路徑:
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
配置模塊化層2(ML2)插件?
ML2插件使用Linux橋接器機(jī)制為實(shí)例構(gòu)建第2層(橋接和交換)虛擬網(wǎng)絡(luò)基礎(chǔ)架構(gòu)。
-
編輯
/etc/neutron/plugins/ml2/ml2_conf.ini文件并完成以下操作:
[ml2]
在本`[ml2]`節(jié)中,啟用平面和VLAN網(wǎng)絡(luò):
type_drivers = flat,vlan
在該[ml2]部分中,禁用自助服務(wù)網(wǎng)絡(luò):
tenant_network_types =
在本[ml2]節(jié)中,啟用Linux橋接機(jī)制:
mechanism_drivers = linuxbridge
在此[ml2]部分中,啟用端口安全擴(kuò)展驅(qū)動(dòng)程序:
extension_drivers = port_security
在本[ml2_type_flat]節(jié)中,將提供者虛擬網(wǎng)絡(luò)配置為平面網(wǎng)絡(luò):
[ml2_type_flat]
# ...
flat_networks = external
在本[securitygroup]節(jié)中,啟用ipset以提高安全組規(guī)則的效率:
[securitygroup]
# ...
enable_ipset = true
## 配置Linux網(wǎng)橋代理[?](https://docs.openstack.org/neutron/stein/install/controller-install-option1-rdo.html#configure-the-linux-bridge-agent "固定到該標(biāo)題")
Linux網(wǎng)橋代理為實(shí)例構(gòu)建第2層(橋接和交換)虛擬網(wǎng)絡(luò)基礎(chǔ)結(jié)構(gòu)并處理安全組。
* 編輯`/etc/neutron/plugins/ml2/linuxbridge_agent.ini`文件并完成以下操作:
* 在本`[linux_bridge]`節(jié)中,將提供者虛擬網(wǎng)絡(luò)映射到提供者物理網(wǎng)絡(luò)接口:
[linux_bridge]
physical_interface_mappings = external:eth0
在該[vxlan]部分中,禁用VXLAN覆蓋網(wǎng)絡(luò):
[vxlan]
enable_vxlan = false
在該[securitygroup]部分中,啟用安全組并配置Linux網(wǎng)橋iptables防火墻驅(qū)動(dòng)程序:
[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
通過(guò)驗(yàn)證以下所有sysctl值是否設(shè)置為確保Linux操作系統(tǒng)內(nèi)核支持網(wǎng)橋過(guò)濾器1:
[root@controller1 ~]# vim /etc/sysctl.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
[root@controller1 ~]# sysctl -p
## 配置DHCP代理[?](https://docs.openstack.org/neutron/stein/install/controller-install-option1-rdo.html#configure-the-dhcp-agent "固定到該標(biāo)題")
DHCP代理為虛擬網(wǎng)絡(luò)提供DHCP服務(wù)。
* 編輯`/etc/neutron/dhcp_agent.ini`文件并完成以下操作:
* 在本`[DEFAULT]`節(jié)中,配置Linux橋接口驅(qū)動(dòng)程序Dnsmasq DHCP驅(qū)動(dòng)程序,并啟用隔離的元數(shù)據(jù),以便提供商網(wǎng)絡(luò)上的實(shí)例可以通過(guò)網(wǎng)絡(luò)訪問元數(shù)據(jù):
[root@controller1 ~]# vim /etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true
配置元數(shù)據(jù)代理?
元數(shù)據(jù)代理提供配置信息,例如實(shí)例的憑據(jù)。
* 編輯`/etc/neutron/metadata_agent.ini`文件并完成以下操作:
* 在該`[DEFAULT]`部分中,配置元數(shù)據(jù)主機(jī)和共享機(jī)密
[DEFAULT]
nova_metadata_host = openstack-vip.wyh.net
metadata_proxy_shared_secret = 20191220
配置計(jì)算服務(wù)使用網(wǎng)絡(luò)服務(wù)
必須安裝Nova計(jì)算服務(wù)才能完成此步驟。有關(guān)更多詳細(xì)信息,請(qǐng)參閱docs網(wǎng)站的“ 安裝指南”部分 下的計(jì)算安裝指南
編輯/etc/nova/nova.conf文件并執(zhí)行以下操作:
在該[neutron]部分中,配置訪問參數(shù),啟用元數(shù)據(jù)代理,并配置機(jī)密
[root@controller1 ~]# vim /etc/nova/nova.conf
url = http://openstack-vip.wyh.net:9696
auth_url = http://openstack-vip.wyh.net:5000
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 = 20191220
最終確定安裝
網(wǎng)絡(luò)服務(wù)初始化腳本需要/etc/neutron/plugin.ini指向ML2插件配置文件的符號(hào)鏈接 /etc/neutron/plugins/ml2/ml2_conf.ini。如果此符號(hào)鏈接不存在,請(qǐng)使用以下命令創(chuàng)建它:
[root@controller1 ~]# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
填充數(shù)據(jù)庫(kù):
[root@controller1 ~]# 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
查看數(shù)據(jù)庫(kù)信息
MariaDB [(none)]> use neutron
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [neutron]> show tables;
+-----------------------------------------+
| Tables_in_neutron |
+-----------------------------------------+
| address_scopes |
重新啟動(dòng)Compute API服務(wù):
[root@controller1 ~]# systemctl restart openstack-nova-api.service
啟動(dòng)網(wǎng)絡(luò)服務(wù),并將其配置為在系統(tǒng)引導(dǎo)時(shí)啟動(dòng)。
對(duì)于兩個(gè)網(wǎng)絡(luò)選項(xiàng):
# systemctl enable neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service
# systemctl start neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service
安裝和配置計(jì)算節(jié)點(diǎn)
計(jì)算節(jié)點(diǎn)處理實(shí)例的連接性和安全性組。
安裝的組件
[root@node1 ~]# yum install openstack-neutron-linuxbridge ebtables ipset -y
編輯/etc/neutron/neutron.conf文件并完成以下操作:
在本[database]節(jié)中,注釋掉所有connection選項(xiàng),因?yàn)橛?jì)算節(jié)點(diǎn)不會(huì)直接訪問數(shù)據(jù)庫(kù)。
在該[DEFAULT]部分中,配置RabbitMQ 消息隊(duì)列訪問:
[DEFAULT]
transport_url = rabbit://openstack:openstack123@openstack-vip.wyh.net
在[DEFAULT]和[keystone_authtoken]部分中,配置身份服務(wù)訪問:
[DEFAULT]
# ...
auth_strategy = keystone
[keystone_authtoken]
www_authenticate_uri = http://openstack-vip.wyh.net:5000
auth_url = http://openstack-vip.wyh.net:5000
memcached_servers = openstack-vip.wyh.net:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron
在該[oslo_concurrency]部分中,配置鎖定路徑:
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
配置提供者網(wǎng)絡(luò),參考網(wǎng)站
[https://docs.openstack.org/neutron/stein/install/compute-install-option1-rdo.html](https://docs.openstack.org/neutron/stein/install/compute-install-option1-rdo.html)
## 配置Linux網(wǎng)橋代理[?](https://docs.openstack.org/neutron/stein/install/compute-install-option1-rdo.html#configure-the-linux-bridge-agent "固定到該標(biāo)題")
Linux網(wǎng)橋代理為實(shí)例構(gòu)建第2層(橋接和交換)虛擬網(wǎng)絡(luò)基礎(chǔ)結(jié)構(gòu)并處理安全組。
* 編輯`/etc/neutron/plugins/ml2/linuxbridge_agent.ini`文件并完成以下操作:
在本[linux_bridge]節(jié)中,將提供者虛擬網(wǎng)絡(luò)映射到提供者物理網(wǎng)絡(luò)接口:
[linux_bridge]
physical_interface_mappings = external:eth0
在該[vxlan]部分中,禁用VXLAN覆蓋網(wǎng)絡(luò):
[vxlan]
enable_vxlan = false
在該[securitygroup]部分中,啟用安全組并配置Linux網(wǎng)橋iptables防火墻驅(qū)動(dòng)程序:
[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
通過(guò)驗(yàn)證以下所有sysctl值是否設(shè)置為確保Linux操作系統(tǒng)內(nèi)核支持網(wǎng)橋過(guò)濾器1:
[root@node1 ~]# vim /etc/sysctl.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
[root@controller1 ~]# sysctl -p
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
## 配置計(jì)算服務(wù)使用網(wǎng)絡(luò)服務(wù)(https://docs.openstack.org/neutron/stein/install/compute-install-rdo.html#configure-the-compute-service-to-use-the-networking-service "固定到該標(biāo)題")
* 編輯`/etc/nova/nova.conf`文件并完成以下操作:
* 在該`[neutron]`部分中,配置訪問參數(shù)
[neutron]
url = http://openstack-vip.wyh.net:9696
auth_url = http://openstack-vip.wyh.net:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron
## 最終確定安裝[?](https://docs.openstack.org/neutron/stein/install/compute-install-rdo.html#finalize-installation "固定到該標(biāo)題")
1. 重新啟動(dòng)計(jì)算服務(wù)
# systemctl restart openstack-nova-compute.service
啟動(dòng)Linux網(wǎng)橋代理,并將其配置為在系統(tǒng)引導(dǎo)時(shí)啟動(dòng):
# systemctl enable neutron-linuxbridge-agent.service
# systemctl start neutron-linuxbridge-agent.service
創(chuàng)建腳本目錄
[root@node1 ~]# mkdir scripts
[root@node1 ~]# vim scripts/nova-restart_agent.sh
#!/bin/bash
systemctl restart openstack-nova-compute.service
[root@node1 ~]# vim scripts/neutron-restart_agent.sh
#!/bin/bash
systemctl restart neutron-linuxbridge-agent.service
[root@node1 ~]# sysctl -p
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
檢查日志
[root@node1 scripts]# tail -f /var/log/neutron/linuxbridge-agent.log