一蜒简、部署基礎(chǔ)環(huán)境:
A.IP地址規(guī)劃:
controller節(jié)點:192.168.0.201首装,compute節(jié)點:192.168.0.202
B.關(guān)閉防火墻Firewalld(所有節(jié)點)
systemctl disable firewalld.service
systemctl stop firewalld.service
C.禁止Selinux內(nèi)核安全機制(所有節(jié)點)
vim /etc/sysconfig/selinux
SELINUX=disabled
D.配置固定IP地址(所有節(jié)點)
ens33(外網(wǎng)地址);ens37(內(nèi)網(wǎng)地址)
controller:ens37? ?192.168.0.201
compute:ens37? ? 192.168.0.202
二飘言、構(gòu)建企業(yè)私有云平臺實施步驟如下:
1.? 配置hosts和hostname(controller和compute節(jié)點)
vi /etc/hostname(controller節(jié)點)
controller
vi /etc/hostname(compute節(jié)點)
compute
vi /etc/hosts(controller和compute節(jié)點)
192.168.0.201? ? controller
192.168.0.202? ? compute
2.? 配置NTP(controller和compute節(jié)點)
在controller節(jié)點配置
下載:yum -y install chrony
配置:vi /etc/chrony.conf
allow 192.168.0.0/24
server ntp1.aliyun.com iburst
啟動
systemctl enable chronyd.service
systemctl start chronyd.service
驗證
chronyc sources
在compute節(jié)點配置
下載:yum -y install chrony
配置:vi /etc/chrony.conf(刪除所有內(nèi)容)
server controller iburst
啟動
systemctl enable chronyd.service
systemctl start chronyd.service
驗證
chronyc sources
3.? 使用阿里云官方Y(jié)UM源(所有節(jié)點)注:本操作跳過
備份
cd /etc/yum.repo.d/
mkdir bak
mv C* ./bak
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
獲取阿里源文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
更新cache
yum makecache
更新
yum -y update
4.? 安裝openstack包(所有節(jié)點)
注:如果通過yum源無法找到其依賴包,那么可以換源
下載pike
yum -y install centos-release-openstack-pike
更新
yum -y upgrade
下載openstackclient
yum install python-openstackclient
下載selinux
yum install openstack-selinux
4. 安裝數(shù)據(jù)庫(僅controller節(jié)點)
下載mariadb
yum -y install mariadb mariadb-server python2-PyMySQL
創(chuàng)建openstack.cnf
vi /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address =192.168.0.201
default-storage-engine = innodb
innodb_file_per_tablemax_connections =4096
collation-server = utf8_general_ci
character-set-server = utf8
啟動
systemctl enable mariadb.service
systemctl start mariadb.service
修改密碼
登錄:mysql -u root mysql
修改密碼:UPDATE user SET PASSWORD=PASSWORD('123456') where USER='root';
立即刷新:FLUSH PRIVILEGES;
退出:quit
5.? 安裝rabbitmq(僅controller節(jié)點)
下載
yum -y install rabbitmq-server
啟動
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
添加openstack用戶
rabbitmqctl add_user openstack 123456
添加權(quán)限
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
5.? 安裝memcached(僅controller節(jié)點)
下載
yum -y install memcached python-memcached
配置
vi /etc/sysconfig/memcached
OPTIONS="-l 127.0.0.1,::1,controller"
啟動
systemctl enable memcached.service
systemctl start memcached.service
6.? 安裝Etcd(僅controller節(jié)點)這是一個分布式的可靠鍵值存儲韧骗,用于分布式密鑰鎖定翎苫、存儲配置权埠、跟蹤服務(wù)的實時狀態(tài)和其他場景
下載
yum -y install etcd
配置
vi /etc/etcd/etcd.conf
#[Member]
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://192.168.0.201:2380"
ETCD_LISTEN_CLIENT_URLS="http://192.168.0.201:2379"
ETCD_NAME="controller"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.0.201:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.0.201:2379"
ETCD_INITIAL_CLUSTER="controller=http://192.168.0.201:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"
啟動
systemctl enable etcd
systemctl start etcd
7.? 身份服務(wù)(僅controller節(jié)點)
數(shù)據(jù)庫
登錄mysql -uroot -p123456
注:如果顯示 1045報錯,那么執(zhí)行以下操作
停服務(wù):systemctl stop mariadb.service
啟動服務(wù):mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
登錄:mysql -u root mysql
改密碼:UPDATE user SET PASSWORD=PASSWORD('123456') where USER='root';
FLUSH PRIVILEGES;
退出:quit
創(chuàng)建數(shù)據(jù)庫keystone
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'controller' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY '123456';
下載和配置
下載
yum -y install openstack-keystone httpd mod_wsgi
配置
vi /etc/keystone/keystone.conf
[database]
...connection = mysql+pymysql://keystone:123456@controller/keystone
[token]
...provider = fernet
創(chuàng)建數(shù)據(jù)庫
su -s /bin/sh -c "keystone-manage db_sync" keystone
初始化Fernet密鑰存儲庫:
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
初始化身份服務(wù)
keystone-manage bootstrap --bootstrap-password 123456 --bootstrap-admin-url http://controller:35357/v3/ --bootstrap-internal-url http://controller:5000/v3/ --bootstrap-public-url http://controller:5000/v3/ --bootstrap-region-id RegionOne
配置httpd
配置:vi /etc/httpd/conf/httpd.conf
ServerName controller
創(chuàng)建link:ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
啟動服務(wù)
systemctl enable httpd.service
systemctl start httpd.service
登錄
export OS_USERNAME=admin
export OS_PASSWORD=123456
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://controller:35357/v3
export OS_IDENTITY_API_VERSION=3
創(chuàng)建 domain, projects, users, and roles
創(chuàng)建 service project
openstack project create --domain default --description "Service Project" service
2、創(chuàng)建 demo project
openstack project create --domain default --description "Demo Project" demo
3煎谍、創(chuàng)建 demo user:
openstack user create --domain default --password-prompt demo
4弊知、創(chuàng)建 user role:
openstack role create user
5、關(guān)聯(lián)
openstack role add --project demo --user demo user
驗證
1粱快、登出
unset OS_AUTH_URL OS_PASSWORD
2秩彤、驗證 admin
openstack --os-auth-url http://controller:35357/v3 --os-project-domain-name Default --os-user-domain-name Default --os-project-name admin --os-username admin token issue
3、驗證 demo
openstack --os-auth-url http://controller:5000/v3 --os-project-domain-name Default --os-user-domain-name Default --os-project-name demo --os-username demo token issue
創(chuàng)建登錄腳本(在root的~目錄下)
注: 通過 readlink -f ./ 獲取當(dāng)前目錄的絕對路徑
A事哭、創(chuàng)建 admin-openrc
vim admin-openrc
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=123456
export OS_AUTH_URL=http://controller:35357/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
B漫雷、創(chuàng)建 demo-openrc
vi demo-openrc
exportOS_PROJECT_DOMAIN_NAME=Default
exportOS_USER_DOMAIN_NAME=Default
exportOS_PROJECT_NAME=demo
exportOS_USERNAME=demo
exportOS_PASSWORD=123456
exportOS_AUTH_URL=http://controller:5000/v3 exportOS_IDENTITY_API_VERSION=3
exportOS_IMAGE_API_VERSION=2
C、驗證admin
登錄:. admin-openrc
注:登錄也可以用source admin-openrc鳍咱,注意上面是 . admin-openrc降盹,不是 ./admin-openrc
驗證:openstack token issue
4、查看環(huán)境變量
echo $OS_PROJECT_DOMAIN_NAME $OS_USER_DOMAIN_NAME $OS_PROJECT_NAME $OS_USERNAME $OS_PASSWORD $OS_AUTH_URL $OS_IDENTITY_API_VERSION $OS_IMAGE_API_VERSION
5谤辜、登出
unset OS_PROJECT_DOMAIN_NAME OS_USER_DOMAIN_NAME OS_PROJECT_NAME OS_USERNAME OS_PASSWORD OS_AUTH_URL OS_IDENTITY_API_VERSION OS_IMAGE_API_VERSION
8.? 鏡像服務(wù)(僅controller節(jié)點)
數(shù)據(jù)庫
A.登錄
mysql -uroot -p123456
B.創(chuàng)建數(shù)據(jù)庫glance
CREATE DATABASE glance;
C.登錄操作權(quán)限
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'controller' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '123456';
D.退出 exit
創(chuàng)建 glance
A.登錄 . admin-openrc
B.創(chuàng)建 glance user:
openstack user create --domain default --password-prompt glance
C.關(guān)聯(lián)
openstack role add --project service --user glance admin
D.創(chuàng)建 glance service:
openstack service create --name glance --description "OpenStack Image" image
E.創(chuàng)建API
openstack endpoint create --region RegionOne image public http://controller:9292
openstack endpoint create --region RegionOne image internal http://controller:9292
openstack endpoint create --region RegionOne image admin http://controller:9292
下載和配置
A.下載
yum -y install openstack-glance
B.配置
vim /etc/glance/glance-api.conf
[database]
...
connection = mysql+pymysql://glance:123456@controller/glance
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name =default
user_domain_name =default
project_name = service
username = glance
password =123456
[paste_deploy]
...
flavor = keystone
[glance_store]
...
stores = file,http
default_store = file
filesystem_store_datadir =/var/lib/glance/images/
C.配置
vim /etc/glance/glance-registry.conf
[database]
...
connection = mysql+pymysql://glance:123456@controller/glance
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name =default
user_domain_name =default
project_name = service
username = glance
password =123456
[paste_deploy]
...
flavor = keystone
D.填充數(shù)據(jù)庫
su -s /bin/sh -c "glance-manage db_sync" glance
E.啟動
systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service
驗證
A.登錄:. admin-openrc
B.下載:wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
C.上傳:openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public
E.查看列表
openstack image list
9. 計算服務(wù)(controller節(jié)點)
數(shù)據(jù)庫
A.登錄:mysql -u root -p123456
B.創(chuàng)建數(shù)據(jù)庫:
CREATE DATABASE nova_api;
CREATE DATABASE nova;
CREATE DATABASE nova_cell0;
C.設(shè)置權(quán)限
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'controller' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'controller' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'controller' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY '123456';
D.退出exit
創(chuàng)建 nova
A.登錄. admin-openrc
B.創(chuàng)建 nova user:
openstack user create --domain default --password-prompt nova
C.關(guān)聯(lián)
openstack role add --project service --user nova admin
D.創(chuàng)建 nova service
openstack service create --name nova --description "OpenStack Compute" compute
E.創(chuàng)建 API
openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1
創(chuàng)建 placement
A.登錄. admin-openrc
B.創(chuàng)建 placement user
openstack user create --domain default --password-prompt placement
C.關(guān)聯(lián)
openstack role add --project service --user placement admin
D.創(chuàng)建 API
openstack service create --name placement --description "Placement API" placement
openstack endpoint create --region RegionOne placement public http://controller:8778
openstack endpoint create --region RegionOne placement internal http://controller:8778
openstack endpoint create --region RegionOne placement admin http://controller:8778
下載和配置
A.下載:
yum -y install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api
B.配置
vi /etc/nova/nova.conf
[DEFAULT]
...
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:123456@controller
my_ip =192.168.0.201use_neutron =Truefirewall_driver = nova.virt.firewall.NoopFirewallDriver
[api_database]
...
connection = mysql+pymysql://nova:123456@controller/nova_api
[database]
...
connection = mysql+pymysql://nova:123456@controller/nova
[api]
...
auth_strategy = keystone
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name =default
user_domain_name =default
project_name = service
username = nova
password =123456
[vnc]
enabled =true
...
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
[glance]
...
api_servers = http://controller:9292
[oslo_concurrency]
...
lock_path = /var/lib/nova/tmp
[placement]
...
os_region_name = RegionOne
project_domain_name =Default
project_name = service
auth_type = password
user_domain_name =Default
auth_url = http://controller:35357/v3
username = placement
password =123456
注:刪掉[placement] [keystone_authtoken]的其他項
C.配置
vi /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>
D.重啟httpd
systemctl restart httpd.service
E.填充數(shù)據(jù)庫
su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
su -s /bin/sh -c "nova-manage db sync" nova
F.驗證 cell0 cell1
nova-manage cell_v2 list_cells
G.啟動
systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
10. 計算服務(wù)(compute節(jié)點)
下載和配置
A.下載
yum -y install openstack-nova-compute
B.配置
vim /etc/nova/nova.conf
[DEFAULT]
...
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:123456@controller
my_ip =192.168.0.202
use_neutron =True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api]
...
auth_strategy = keystone
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name =default
user_domain_name =default
project_name = service
username = nova
password =123456
[vnc]
...
enabled =True
vncserver_listen =0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html
[glance]
...
api_servers = http://controller:9292
[oslo_concurrency]
...
lock_path = /var/lib/nova/tmp
[placement]
...
os_region_name = RegionOne
project_domain_name =Default
project_name = service
auth_type = password
user_domain_name =Default
auth_url = http://controller:35357/v3
username = placement
password = 123456
C.啟動
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
11.? 計算服務(wù)(controller節(jié)點)
添加compute節(jié)點到cell數(shù)據(jù)庫
A.登陸:. admin-openrc
B.查看:openstack compute service list --service nova-compute
C.手動注冊compute節(jié)點到cell數(shù)據(jù)庫 (每次添加新compute節(jié)點都需要這個操作)
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
D.自動注冊compute節(jié)點到cell數(shù)據(jù)庫(只需要操作一次)
vi /etc/nova/nova.conf
[scheduler]
discover_hosts_in_cells_interval = 300
注:C與D步操作任選其一
驗證
A.登陸:. admin-openrc
B.查看計算服務(wù)列表:openstack compute service list
C.查看 api:openstack catalog list
D.查看鏡像列表:openstack image list
E.檢查cells和placementAPI 是否正常工作
nova-status upgrade check
12. 網(wǎng)絡(luò)服務(wù)(controller節(jié)點)
數(shù)據(jù)庫
A.登陸:mysql -uroot -p123456
B.創(chuàng)建neutron
CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'controller' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY '123456';
C.登出:exit
創(chuàng)建neutron用戶
A.登陸:
. admin-openrc
B.創(chuàng)建neutron用戶:
openstack user create --domain default --password-prompt neutron
C.關(guān)聯(lián):
openstack role add --project service --user neutron admin
D.創(chuàng)建neutronservice:
openstack service create --name neutron --description "OpenStack Networking" network
E.創(chuàng)建API:
openstack endpoint create --region RegionOne network public http://controller:9696
openstack endpoint create --region RegionOne network internal http://controller:9696
openstack endpoint create --region RegionOne network admin http://controller:9696
安裝和配置(基于Provider networks)
A.安裝:
yum -y install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables
B.配置:
vim /etc/neutron/neutron.conf
[DEFAULT]
...
core_plugin = ml2
service_plugins =?
transport_url = rabbit://openstack:123456@controller
auth_strategy = keystone
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
[database]
...
connection = mysql+pymysql://neutron:123456@controller/neutron
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = 123456
[nova]
...
auth_url = http://controller:35357
auth_type = password
project_domain_name =default
user_domain_name =default
region_name = RegionOne
project_name = service
username = nova
password = 123456
[oslo_concurrency]
...
lock_path = /var/lib/neutron/tmp
C.配置
vi /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
...
type_drivers = flat,vlan
tenant_network_types =?
mechanism_drivers = linuxbridge
extension_drivers = port_security
[ml2_type_flat]
...
flat_networks = provider
[securitygroup]
...
enable_ipset = true
D.配置
vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:eth1
[vxlan]
enable_vxlan =false
[securitygroup]
...
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
E.配置
vi /etc/neutron/dhcp_agent.ini
[DEFAULT]
...
interface_driver = linuxbridgedhcp_driver = neutron.agent.linux.dhcp.Dnsmasqenable_isolated_metadata = true
配置和啟動
A.配置
vim /etc/neutron/metadata_agent.ini
[DEFAULT]
...
nova_metadata_host = controller
metadata_proxy_shared_secret = 123456
B.配置
vim /etc/nova/nova.conf
[neutron]
...
url = http://controller:9696
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = 123456
service_metadata_proxy = true
metadata_proxy_shared_secret = 123456
C.link創(chuàng)建軟鏈接文件
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
D.填充數(shù)據(jù)庫
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
E.重啟APIservice
systemctl restart openstack-nova-api.service
F.啟動服務(wù)
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
13. 網(wǎng)絡(luò)服務(wù)(compute節(jié)點)
安裝和配置
A.下載
yum -y install openstack-neutron-linuxbridge ebtables ipset
B.配置
vim /etc/neutron/neutron.conf
[DEFAULT]
...
transport_url = rabbit://openstack:123456@controller
auth_strategy = keystone
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = 123456
[oslo_concurrency]
...
lock_path = /var/lib/neutron/tmp
配置(基于 Provider networks)
A.配置
vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:eth1
[vxlan]
enable_vxlan =false
[securitygroup]
...
enable_security_group =true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
配置和啟動
A.配置
vi /etc/nova/nova.conf
[neutron]
...
url = http://controller:9696
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password =123456
B.啟動
systemctl restart openstack-nova-compute.service
systemctl enable neutron-linuxbridge-agent.service
systemctl start neutron-linuxbridge-agent.service
驗證(Controller 節(jié)點)
A.登錄:. admin-openrc
B.查看列表:openstack network agent list
14. 儀表盤dashboard(controller節(jié)點)
A.下載
yum -y install openstack-dashboard
B.配置
vim /etc/openstack-dashboard/local_settings
OPENSTACK_HOST ="controller"
OPENSTACK_KEYSTONE_URL ="http://%s:5000/v3"% OPENSTACK_HOST
OPENSTACK_KEYSTONE_DEFAULT_ROLE ="user"
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
SESSION_ENGINE ='django.contrib.sessions.backends.cache'
CACHES = {'default': {'BACKEND':'django.core.cache.backends.memcached.MemcachedCache','LOCATION':'controller:11211',? }}OPENSTACK_API_VERSIONS = {"identity":3,"image":2,"volume":2,}OPENSTACK_KEYSTONE_DEFAULT_DOMAIN ="Default"ALLOWED_HOSTS = ['*']OPENSTACK_NEUTRON_NETWORK = {? ...'enable_router':False,'enable_quotas':False,'enable_distributed_router':False,'enable_ha_router':False,'enable_lb':False,'enable_firewall':False,'enable_vpn':False,'enable_fip_topology_check':False,}TIME_ZONE ="UTC"
C.配置
vim /etc/httpd/conf.d/openstack-dashboard.conf
...
WSGIApplicationGroup %{GLOBAL}
D.重啟
systemctl restart httpd.service memcached.service
E.測試
http://192.168.0.201/dashboard
15.啟動一個實例
創(chuàng)建虛擬網(wǎng)絡(luò)(基于 provider networks)
登錄. admin-openrc
創(chuàng)建network
openstack network create --share --external --provider-physical-network provider --provider-network-type flat provider
image.png
創(chuàng)建子網(wǎng)
openstack subnet create --network provider --allocation-pool start=192.168.0.220,end=192.168.0.229 --dns-nameserver 192.168.0.1 --gateway 192.168.0.1 --subnet-range 192.168.0.0/24 provider
image.png
創(chuàng)建flavor
登錄. admin-openrc
創(chuàng)建:
openstack flavor create --id 0 --vcpus 1 --ram 64 --disk 1 m1.nano
創(chuàng)建 key pair
登錄:. demo-openrc
創(chuàng)建:
ssh-keygen -q -N ""
回車
openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey
查看
openstack keypair list
配置安全組
登錄:. demo-openrc
ICMP
openstack security group rule create --proto icmp default
SSH
openstack security group rule create --proto tcp --dst-port 22 default
創(chuàng)建一個instance