openstack R版搭建
openstack R版搭建
文章目錄
- openstack R版搭建
- 作者:40kuai
- 部落格:http://www.cnblogs.com/40kuai/
- 個人部落格 :http://www.heleicool.cn/
- 有疑問可以加本人QQ:948793841
- 實驗環境
- 環境設定
- 安裝openstack包
- 資料庫安裝
- 安裝訊息佇列
- 目前為止埠資訊如下
- 開始安裝openstack服務
作者:40kuai
部落格:http://www.cnblogs.com/40kuai/
個人部落格 :http://www.heleicool.cn/
有疑問可以加本人QQ:948793841
實驗環境
系統:CentOS-7-x86_64-DVD-1804
實驗環境:vmware
hostname | ip | 功能 |
---|---|---|
node1.heleicool.cn | 172.16.175.11 | 管理節點 |
node2.heleicool.cn | 172.16.175.12 | 計算節點 |
其他資訊:
root密碼:123123
環境設定
安裝必要軟體:
yum install -y vim net-tools wget telnet
修改主機名:
配置網絡卡資訊:網段為172.16.175.0/24
,閘道器為172.16.175.2
node1節點網絡卡配置如下:
TYPE="Ethernet"
BOOTPROTO="static"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR=172.16.175.11
NETMASK=255.255.255.0
GATEWAY=172.16.175.2
node2節點網絡卡配置如下:
TYPE="Ethernet"
BOOTPROTO="static"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR=172.16.175.12
NETMASK=255.255.255.0
GATEWAY=172.16.175.2
重啟網絡卡:
systemctl restart network
分別配置/etc/hosts
檔案:
172.16.175.11 node1.heleicool.cn
172.16.175.12 node2.heleicool.cn
分別配置/etc/resolv.conf
檔案:
nameserver 8.8.8.8
關閉防火牆:
systemctl disable firewalld
systemctl stop firewalld
關閉selinux:(應該可以省略)
setenforce 0
vim /etc/selinux/config
SELINUX=disabled
安裝openstack包
安裝對應版本的epel庫:
yum install centos-release-openstack-rocky -y
安裝openstack客戶端:
yum install python-openstackclient -y
RHEL和CentOS 預設啟用SELinux。安裝 openstack-selinux
軟體包以自動管理OpenStack服務的安全策略:
yum install openstack-selinux -y
資料庫安裝
安裝包:
yum install mariadb mariadb-server python2-PyMySQL -y
建立和編輯配置檔案/etc/my.cnf.d/openstack.cnf
:
[mysqld]
bind-address = 172.16.175.11
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
啟動資料庫:
systemctl enable mariadb.service
systemctl start mariadb.service
通過執行mysql_secure_installation
指令碼來保護資料庫服務。特別是,為資料庫root
帳戶選擇合適的密碼 :
mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y # 是否設定root密碼
New password: # 輸入兩次root密碼
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y # 是否刪除匿名使用者
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y # 是否禁止root遠端登陸
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y # 是否刪除test庫
▽
- Dropping test database...
▽
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y # 載入許可權表
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
安裝訊息佇列
安裝rabbitmq
yum install rabbitmq-server -y
啟動rabbitmy
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
新增openstack使用者
# 我 新增的使用者名稱為openstack,密碼也是。
rabbitmqctl add_user openstack openstack
對openstack使用者進行讀寫授權:
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
###安裝Memcached
安裝Memacached
yum install memcached python-memcached -y
編輯/etc/sysconfig/memcached
,修改配置
OPTIONS="-l 127.0.0.1,::1,172.16.175.11"
啟動memcached
systemctl enable memcached.service
systemctl start memcached.service
目前為止埠資訊如下
# rabbitmq 埠
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 1690/beam
# mariadb-server 埠
tcp 0 0 172.16.175.11:3306 0.0.0.0:* LISTEN 1506/mysqld
# memcached 埠
tcp 0 0 172.16.175.11:11211 0.0.0.0:* LISTEN 2236/memcached
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 2236/memcached
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 766/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1050/master
tcp6 0 0 :::5672 :::* LISTEN 1690/beam
tcp6 0 0 ::1:11211 :::* LISTEN 2236/memcached
tcp6 0 0 :::22 :::* LISTEN 766/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1050/master
開始安裝openstack服務
keystone服務安裝
配置keystone資料庫:
使用資料庫訪問客戶端以root
使用者身份連線到資料庫伺服器:
mysql -u root -p
建立keystone
資料庫,授予對keystone
資料庫的適當訪問許可權:
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'keystone';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'keystone';
安裝配置keystone
執行以下命令以安裝軟體包:
yum install openstack-keystone httpd mod_wsgi -y
編輯/etc/keystone/keystone.conf
檔案並完成以下操作:
[database]
connection = mysql+pymysql://keystone:[email protected]/keystone
[token]
provider = fernet
填充Identity服務資料庫:
su -s /bin/sh -c "keystone-manage db_sync" keystone
# 驗證資料庫表
mysql -ukeystone -pkeystone -e "use keystone; show tables;"
初始化Fernet金鑰儲存庫:
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
引導身份服務:
# ADMIN_PASS為管理使用者的密碼,這裡是設定密碼。
keystone-manage bootstrap --bootstrap-password admin \
--bootstrap-admin-url http://172.16.175.11:5000/v3/ \
--bootstrap-internal-url http://172.16.175.11:5000/v3/ \
--bootstrap-public-url http://172.16.175.11:5000/v3/ \
--bootstrap-region-id RegionOne
配置Apache HTTP服務
編輯/etc/httpd/conf/httpd.conf
ServerName 172.16.175.11
建立/usr/share/keystone/wsgi-keystone.conf檔案的連結:
ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
啟動服務
啟動Apache HTTP服務並將其配置為在系統引導時啟動:
systemctl enable httpd.service
systemctl start httpd.service
配置管理帳戶
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://172.16.175.11:5000/v3
export OS_IDENTITY_API_VERSION=3
建立domain,projects,users and roles
雖然本指南中的keystone-manage bootstrap步驟中已存在“預設”域,但建立新域的正式方法是:
# openstack domain create --description "An Example Domain" example
使用預設的domain,建立service project:用做服務。
openstack project create --domain default \
--description "Service Project" service
建立myproject
專案:用做常規(非管理員)任務應使用非特權專案和使用者。
openstack project create --domain default \
--description "Demo Project" myproject
建立myuser
使用者:
# 建立使用者需要輸入密碼
openstack user create --domain default \
--password-prompt myuser
建立myrole
角色:
openstack role create myrole
將myuser新增到myproject專案中並賦予myrole的角色:
openstack role add --project myproject --user myuser myrole
驗證使用者
取消設定臨時 變數OS_AUTH_URL
和OS_PASSWORD
環境變數:
unset OS_AUTH_URL OS_PASSWORD
作為admin
使用者,請求身份驗證令牌:
# 執行後需要輸入admin密碼
openstack --os-auth-url http://172.16.175.11:5000/v3 \
--os-project-domain-name Default --os-user-domain-name Default \
--os-project-name admin --os-username admin token issue
作為myuser
使用者,請求身份驗證令牌:
# 執行後需要輸入admin密碼
openstack --os-auth-url http://172.16.175.11:5000/v3 \
--os-project-domain-name Default --os-user-domain-name Default \
--os-project-name myproject --os-username myuser token issue
建立openstack 客戶端環境指令碼
openstack客戶端通過新增引數或使用環境變數的方式來與Identity服務進行互動,為了提高效率,建立環境指令碼:
建立admin
使用者環境指令碼:admin-openstack.sh
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://172.16.175.11:5000/v3
export OS_IDENTITY_API_VERSION=3
建立myuser
使用者環境指令碼:demo-openstack.sh
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=myproject
export OS_USERNAME=myuser
export OS_PASSWORD=myuser
export OS_AUTH_URL=http://172.16.175.11:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
使用指令碼
source admin-openstack.sh
openstack token issue
glance服務安裝
配置glance資料庫:
root使用者登陸資料庫:
mysql -u root -p
建立glance資料庫和使用者授權:
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glance';
建立glance服務憑證,使用admin使用者:
source admin-openstack.sh
建立glance使用者:
# 需要輸入glance使用者密碼,我的是 glance
openstack user create --domain default --password-prompt glance
將glance使用者新增到service專案中,並賦予admin角色:
openstack role add --project service --user glance admin
建立glance服務實體:
openstack service create --name glance \
--description "OpenStack Image" image
建立Image服務API端點:
openstack endpoint create --region RegionOne image public http://172.16.175.11:9292
openstack endpoint create --region RegionOne image internal http://172.16.175.11:9292
openstack endpoint create --region RegionOne image admin http://172.16.175.11:9292
安裝和配置glance
安裝包:
yum install openstack-glance -y
編輯/etc/glance/glance-api.conf
檔案並完成以下操作:
# 配置資料庫訪問:
[database]
connection = mysql+pymysql://glance:[email protected]/glance
# 配置身份服務訪問:
[keystone_authtoken]
www_authenticate_uri = http://172.16.175.11:5000
auth_url = http://172.16.175.11:5000
memcached_servers = 172.16.175.11:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glance
[paste_deploy]
flavor = keystone
# 配置本地檔案系統儲存和映像檔案的位置:
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
編輯/etc/glance/glance-registry.conf
檔案並完成以下操作:
# 配置資料庫訪問:
[database]
connection = mysql+pymysql://glance:[email protected]/glance
# 配置身份服務訪問:
[keystone_authtoken]
www_authenticate_uri = http://172.16.175.11:5000
auth_url = http://172.16.175.11:5000
memcached_servers = 172.16.175.11:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glance
[paste_deploy]
flavor = keystone
填充Image服務資料庫,並驗證:
su -s /bin/sh -c "glance-manage db_sync" glance
mysql -uglance -pglance -e "use glance; show tables;"
啟動服務:
systemctl enable openstack-glance-api.service \
openstack-glance-registry.service
systemctl start openstack-glance-api.service \
openstack-glance-registry.service
驗證服務
來源admin
憑據來訪問僅管理員CLI命令:
source admin-openstack.sh
下載源影象:
wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
使用QCOW2磁碟格式,bare容器格式和公共可見性將影象上載到Image服務 ,以便所有專案都可以訪問它:
# 確保cirros-0.4.0-x86_64-disk.img 檔案在當前目錄下
openstack image create "cirros" \
--file cirros-0.4.0-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public
確認上傳影象並驗證屬性:
openstack image list
nova服務安裝
Nova控制節點安裝
建立nova資料庫資訊:
mysql -u root -p
建立nova_api
,nova
,nova_cell0
,和placement
資料庫:
CREATE DATABASE nova_api;
CREATE DATABASE nova;
CREATE DATABASE nova_cell0;
CREATE DATABASE placement;
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'nova';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'nova';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'nova';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova';
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY 'placement';
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'placement';
使用admin許可權訪問:
source admin-openstack.sh
建立nova
使用者:
openstack user create --domain default --password-prompt nova
將admin
角色新增到nova
使用者:
openstack role add --project service --user nova admin
建立nova
服務實體:
openstack service create --name nova --description "OpenStack Compute" compute
建立Compute API服務端點:
openstack endpoint create --region RegionOne compute public http://172.16.175.11:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://172.16.175.11:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://172.16.175.11:8774/v2.1
建立placement
使用者:
# 需要設定使用者名稱的密碼,我的密碼是 placement
openstack user create --domain default --password-prompt placement
使用admin角色將Placement使用者新增到服務專案:
openstack role add --project service --user placement admin
建立placement
服務實體:
openstack service create --name placement --description "Placement API" placement
建立Placement API服務端點:
openstack endpoint create --region RegionOne placement public http://172.16.175.11:8778
openstack endpoint create --region RegionOne placement internal http://172.16.175.11:8778
openstack endpoint create --region RegionOne placement admin http://172.16.175.11:8778
#####安裝nova
yum install openstack-nova-api openstack-nova-conductor \
openstack-nova-console openstack-nova-novncproxy \
openstack-nova-scheduler openstack-nova-placement-api -y
編輯/etc/nova/nova.conf
檔案並完成以下操作:
# 僅啟用計算和元資料API
[DEFAULT]
enabled_apis = osapi_compute,metadata
# 配置資料庫訪問
[api_database]
connection = mysql+pymysql://nova:[email protected]/nova_api
[database]
connection = mysql+pymysql://nova:[email protected]/nova
[placement_database]
connection = mysql+pymysql://placement:[email protected]/placement
# 配置RabbitMQ訊息佇列訪問
[DEFAULT]
transport_url = rabbit://openstack:[email protected]
# 配置身份服務訪問
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_url = http://172.16.175.11:5000/v3
memcached_servers = 172.16.175.11:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova
# 啟用對網路服務的支援
[DEFAULT]
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
# 配置VNC代理以使用控制器節點的管理介面IP地址
[vnc]
enabled = true
server_listen = 0.0.0.0
server_proxyclient_address = 172.16.175.11
# 配置Image服務API的位置
[glance]
api_servers = http://172.16.175.11:9292
# 配置鎖定路徑
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
# 配置Placement API
[placement]
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://172.16.175.11:5000/v3
username = placement
password = placement
配置新增到以下內容來啟用對Placement API的訪問 /etc/httpd/conf.d/00-nova-placement-api.conf
:
新增到配置檔案最後
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
重啟httpd服務
systemctl restart httpd
填充nova-api
和placement
資料庫:
su -s /bin/sh -c "nova-manage api_db sync" nova
註冊cell0
資料庫:
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
建立cell1
單元格:
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
填充nova資料庫:
su -s /bin/sh -c "nova-manage db sync" nova
驗證nova cell0和cell1是否正確註冊:
su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
驗證資料庫:
mysql -unova -pnova -e "use nova ; show tables;"
mysql -unova -pnova -e "use nova_api ; show tables;"
mysql -unova -pnova -e "use nova_cell0 ; show tables;"
mysql -uplacement -pplacement -e "use placement ; show tables;"
啟動nova 控制節點服務
systemctl enable openstack-nova-api.service \
openstack-nova-scheduler.service openstack-nova-conductor.service \
openstack-nova-novncproxy.service
systemctl start openstack-nova-api.service \
openstack-nova-scheduler.service openstack-nova-conductor.service \
openstack-nova-novncproxy.service
Nova計算節點安裝
安裝包
yum install openstack-nova-compute -y
編輯/etc/nova/nova.conf
檔案並完成以下操作:
# 拉取控制節點配置進行修改。刪除以下配置即可,這些是資料庫訪問的配置。
[api_database]
connection = mysql+pymysql://nova:[email protected]/nova_api
[database]
connection = mysql+pymysql://nova:[email protected]/nova
[placement_database]
connection = mysql+pymysql://placement:[email protected]/placement
# 新增內容如下:
[vnc]
# 修改為計算節點的IP
server_proxyclient_address = 172.16.175.12
novncproxy_base_url = http://172.16.175.11:6080/vnc_auto.html
確定您的計算節點是否支援虛擬機器的硬體加速:
egrep -c '(vmx|svm)' /proc/cpuinfo
如果此命令返回值大於1,則計算節點支援硬體加速,通常不需要其他配置。
如果此命令返回值zero
,則您的計算節點不支援硬體加速,您必須配置libvirt
為使用QEMU而不是KVM。
編輯檔案中的[libvirt]
部分,/etc/nova/nova.conf
如下所示:
[libvirt]
# ...
virt_type = kvm
# 我這裡的返回值雖然大於1,但是配置為kvm導致虛擬機器不能啟動,修改為qemu正常,求大神赤腳。
啟動nova計算節點服務
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
將計算節點新增到單元資料庫(在管理節點執行)
source admin-openstack.sh
# 確認資料庫中有主機
openstack compute service list --service nova-compute
# 發現計算主機
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
新增新計算節點時,必須在控制器節點上執行以註冊這些新計算節點。或者,您可以在以下位置設定適當的間隔 :/etc/nova/nova.conf
[scheduler]
discover_hosts_in_cells_interval = 300
驗證操作
source admin-openstack.sh
# 列出服務元件以驗證每個程序的成功啟動和註冊:state為up 狀態
openstack compute service list
# 列出Identity服務中的API端點以驗證與Identity服務的連線
openstack catalog list
# 列出Image服務中的影象以驗證與Image服務的連線:
openstack image list
# 檢查單元格和放置API是否成功執行:
nova-status upgrade check
這裡說明一下,在openstack compute service list
命令進行檢視時官方文件比你多啟動一個伺服器,你啟動它就行了。
這個服務是控制檯遠端連線認證伺服器,不安裝不能進行vnc遠端登入。
systemctl enable openstack-nova-consoleauth
systemctl start openstack-nova-consoleauth
neutron 服務安裝
neutron控制節點安裝
為neutron服務建立資料庫相關:
mysql -uroot -p
CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'neutron';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'neutron';
建立neutron管理使用者
openstack user create --domain default --password-prompt neutron
將neutron
使用者新增到 neutron 服務中,並賦予admin
的角色
openstack role add --project service --user neutron admin
建立neutron
服務實體:
openstack service create --name neutron --description "OpenStack Networking" network
建立網路服務API端點:
openstack endpoint create --region RegionOne network public http://172.16.175.11:9696
openstack endpoint create --region RegionOne network internal http://172.16.175.11:9696
openstack endpoint create --region RegionOne network admin http://172.16.175.11:9696
配置網路選項
您可以使用選項1(Procider)、2(Self-service)表示的兩種體系結構之一來部署網路服務。
選項1部署了最簡單的架構,該架構僅支援將例項附加到提供商(外部)網路。沒有自助(私有)網路,路由器或浮動IP地址。只有該admin
特權使用者或其他特權使用者才能管理提供商網路。
Procider Network
安裝外掛
yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables
配置伺服器元件
編輯/etc/neutron/neutron.conf
檔案並完成以下操作
[DEFAULT]
# 啟用模組化第2層(ML2)外掛並禁用其他外掛
core_plugin = ml2
service_plugins =
# 通知Compute網路拓撲更改
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
# 配置RabbitMQ 訊息佇列訪問
transport_url = rabbit://openstack:[email protected]
auth_strategy = keystone
[database]
# 配置資料庫訪問
connection = mysql+pymysql://neutron:[email protected]/neutron
[keystone_authtoken]
# 配置身份服務訪問
www_authenticate_uri = http://172.16.175.11:5000
auth_url = http://172.16.175.11:5000
memcached_servers = 172.16.175.11:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron
# 配置網路以通知Compute網路拓撲更改
[nova]
auth_url = http://172.16.175.11:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = nova
# 配置鎖定路徑
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
配置模組化第2層(ML2)外掛
ML2外掛使用Linux橋接機制為例項構建第2層(橋接和交換)虛擬網路基礎架構。
編輯/etc/neutron/plugins/ml2/ml2_conf.ini
檔案並完成以下操作:
[ml2]
# 啟用平面和VLAN網路
type_drivers = flat,vlan
# 禁用自助服務網路
tenant_network_types =
# 啟用Linux橋接機制
mechanism_drivers = linuxbridge
# 啟用埠安全性擴充套件驅動程式
extension_drivers = port_security
[ml2_type_flat]
# 將提供商虛擬網路配置為扁平網路
flat_networks = provider
[securitygroup]
# 啟用ipset以提高安全組規則的效率
enable_ipset = true
配置linux網橋代理
Linux網橋代理為例項構建第2層(橋接和交換)虛擬網路基礎架構並處理安全組。
編輯/etc/neutron/plugins/ml2/linuxbridge_agent.ini
檔案並完成以下操作:
[linux_bridge]
# 提供者虛擬網路對映到提供者物理網路介面,這裡的eth-0為對映的網絡卡
physical_interface_mappings = provider:eth-0
[vxlan]
# 禁用VXLAN覆蓋網路
enable_vxlan = false
[securitygroup]
# 啟用安全組並配置Linux橋接iptables防火牆驅動程式:
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
驗證以下所有sysctl
值設定為1
:確保您的Linux作業系統核心支援網橋過濾器:
modprobe br_netfilter
ls /proc/sys/net/bridge
在/etc/sysctl.conf中新增:
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
執行生效
sysctl -p
配置DHCP代理
DHCP代理為虛擬網路提供DHCP服務。
編輯/etc/neutron/dhcp_agent.ini
檔案並完成以下操作:
[DEFAULT]
# 配置Linux橋接介面驅動程式,Dnsmasq DHCP驅動程式,並啟用隔離的元資料,以便提供商網路上的例項可以通過網路訪問元資料:
interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true
Self-service networks
安裝元件
yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables
配置服務元件
編輯/etc/neutron/neutron.conf
檔案並完成以下操作:
[DEFAULT]
# 啟用模組化第2層(ML2)外掛,路由器服務和重疊的IP地址
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = true
# 配置RabbitMQ 訊息佇列訪問
transport_url = rabbit://openstack:[email protected]
auth_strategy = keystone
# 通知Compute網路拓撲更改
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
[database]
# 配置資料庫訪問
connection = mysql+pymysql://neutron:[email protected]/neutron
[keystone_authtoken]
# 配置身份服務訪問
www_authenticate_uri = http://172.16.175.11:5000
auth_url = http://172.16.175.11:5000
memcached_servers = 172.16.175.11:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron
# 配置網路以通知Compute網路拓撲更改
[nova]
auth_url