步骤5:访问Horizon仪表板
[root@openstack ~]# cat keystonerc_admin unset OS_SERVICE_TOKEN export OS_USERNAME=admin export OS_PASSWORD='P@ssw0rd' export OS_REGION_NAME=RegionOne export OS_AUTH_URL=http://192.168.1.100:5000/v3 export PS1='[\u@\h \W(keystone_admin)]\$ ' export OS_PROJECT_NAME=admin export OS_USER_DOMAIN_NAME=Default export OS_PROJECT_DOMAIN_NAME=Default export OS_IDENTITY_API_VERSION=3 [root@openstack ~]#
步骤6:通过启动实例测试和验证OpenStack安装
在openstack中启动实例之前,首先必须创建网络,路由器和上传镜像。因此,让我们首先使用以下neutron命令在管理租户中创建外部网络。
[root@openstack ~]# source keystonerc_admin [root@openstack ~(keystone_admin)]# neutron net-create external_network --provider:network_type flat --provider:physical_network extnet --router:external neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. Created a new network: +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | True | | availability_zone_hints | | | availability_zones | | | created_at | 2020-11-11T08:21:32Z | | description | | | id | 4a1d7ce1-c992-49ec-925b-f6de4ff57631 | | ipv4_address_scope | | | ipv6_address_scope | | | is_default | False | | mtu | 1500 | | name | external_network | | port_security_enabled | True | | project_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 | | provider:network_type | flat | | provider:physical_network | extnet | | provider:segmentation_id | | | qos_policy_id | | | revision_number | 1 | | router:external | True | | shared | False | | status | ACTIVE | | subnets | | | tags | | | tenant_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 | | updated_at | 2020-11-11T08:21:32Z | +---------------------------+--------------------------------------+ [root@openstack ~(keystone_admin)]#
通过运行以下neutron命令,将您的flat网络的子网添加到外部网络
[root@openstack ~(keystone_admin)]# neutron subnet-create --name public_subnet --enable_dhcp=True --allocation-pool=start=192.168.1.210,end=192.168.1.230 --gateway=192.168.1.1 external_network 192.168.1.0/24 neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. Created a new subnet: +-------------------+----------------------------------------------------+ | Field | Value | +-------------------+----------------------------------------------------+ | allocation_pools | {"start": "192.168.1.210", "end": "192.168.1.230"} | | cidr | 192.168.1.0/24 | | created_at | 2020-11-11T08:22:29Z | | description | | | dns_nameservers | | | enable_dhcp | True | | gateway_ip | 192.168.1.1 | | host_routes | | | id | 3cb4d034-5be7-40ef-99fc-69714dc2a108 | | ip_version | 4 | | ipv6_address_mode | | | ipv6_ra_mode | | | name | public_subnet | | network_id | 4a1d7ce1-c992-49ec-925b-f6de4ff57631 | | project_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 | | revision_number | 0 | | service_types | | | subnetpool_id | | | tags | | | tenant_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 | | updated_at | 2020-11-11T08:22:29Z | +-------------------+----------------------------------------------------+ [root@openstack ~(keystone_admin)]#
通过执行以下neutron命令创建路由器,并使用外部网络设置其网关
[root@openstack ~(keystone_admin)]# neutron router-create dev-router neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. Created a new router: +-------------------------+--------------------------------------+ | Field | Value | +-------------------------+--------------------------------------+ | admin_state_up | True | | availability_zone_hints | | | availability_zones | | | created_at | 2020-11-11T08:23:51Z | | description | | | external_gateway_info | | | id | de9e9bfe-5376-4d5f-9c4c-93c2913a9be4 | | name | dev-router | | project_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 | | revision_number | 1 | | routes | | | status | ACTIVE | | tags | | | tenant_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 | | updated_at | 2020-11-11T08:23:51Z | +-------------------------+--------------------------------------+ [root@openstack ~(keystone_admin)]# neutron router-gateway-set dev-router external_network neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. Set gateway for router dev-router [root@openstack ~(keystone_admin)]#
创建私有网络并将一个子网附加到该私有网络,运行以下neutron命令。
[root@openstack ~(keystone_admin)]# neutron net-create pvt_net neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. Created a new network: +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | True | | availability_zone_hints | | | availability_zones | | | created_at | 2020-11-11T08:24:45Z | | description | | | id | 346f678f-b422-4490-aa84-d7f0a0077a85 | | ipv4_address_scope | | | ipv6_address_scope | | | is_default | False | | mtu | 1442 | | name | pvt_net | | port_security_enabled | True | | project_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 | | provider:network_type | geneve | | provider:physical_network | | | provider:segmentation_id | 10 | | qos_policy_id | | | revision_number | 1 | | router:external | False | | shared | False | | status | ACTIVE | | subnets | | | tags | | | tenant_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 | | updated_at | 2020-11-11T08:24:45Z | +---------------------------+--------------------------------------+ [root@openstack ~(keystone_admin)]# neutron subnet-create --name pvt_subnet pvt_net 10.20.1.0/24 neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. Created a new subnet: +-------------------+----------------------------------------------+ | Field | Value | +-------------------+----------------------------------------------+ | allocation_pools | {"start": "10.20.1.2", "end": "10.20.1.254"} | | cidr | 10.20.1.0/24 | | created_at | 2020-11-11T08:24:56Z | | description | | | dns_nameservers | | | enable_dhcp | True | | gateway_ip | 10.20.1.1 | | host_routes | | | id | db78ad37-2f10-4e7f-8e58-27042a6f52b1 | | ip_version | 4 | | ipv6_address_mode | | | ipv6_ra_mode | | | name | pvt_subnet | | network_id | 346f678f-b422-4490-aa84-d7f0a0077a85 | | project_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 | | revision_number | 0 | | service_types | | | subnetpool_id | | | tags | | | tenant_id | 7f6b46bbf1e04095b9c4fda1aa04eb43 | | updated_at | 2020-11-11T08:24:56Z | +-------------------+----------------------------------------------+ [root@openstack ~(keystone_admin)]#
使用以下neutron命令将pvt_net接口添加到路由器“ dev_router ”。
[root@openstack ~(keystone_admin)]# neutron router-interface-add dev-router pvt_subnet neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. Added interface 3a56da05-5020-4c1a-a572-f8c4bb2dbd21 to router dev-router. [root@openstack ~(keystone_admin)]#
下载Cirros 镜像,然后上传到OpenStack中
[root@openstack ~]# source keystonerc_admin [root@openstack ~(keystone_admin)]# wget http://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img [root@openstack ~(keystone_admin)]# openstack image create --disk-format qcow2 --container-format bare --public --file cirros-0.5.1-x86_64-disk.img cirros +------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | checksum | 1d3062cd89af34e419f7100277f38b2b | | container_format | bare | | created_at | 2020-11-11T08:20:01Z | | disk_format | qcow2 | | file | /v2/images/87d7f055-9699-4761-be83-d6f574c42488/file | | id | 87d7f055-9699-4761-be83-d6f574c42488 | | min_disk | 0 | | min_ram | 0 | | name | cirros | | owner | 7f6b46bbf1e04095b9c4fda1aa04eb43 | | properties | os_hash_algo='sha512', os_hash_value='553d220ed58cfee7dafe003c446a9f197ab5edf8ffc09396c74187cf83873c877e7ae041cb80f3b91489acf687183adcd689b53b38e3ddd22e627e7f98a09c46', os_hidden='False', owner_specified.openstack.md5='1d3062cd89af34e419f7100277f38b2b', owner_specified.openstack.object='images/cirros', owner_specified.openstack.sha256='c4110030e2edf06db87f5b6e4efc27300977683d53f040996d15dcc0ad49bb5a', self='/v2/images/87d7f055-9699-4761-be83-d6f574c42488' | | protected | False | | schema | /v2/schemas/image | | size | 16338944 | | status | active | | tags | | | updated_at | 2020-11-11T08:20:02Z | | visibility | public | +------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ [root@openstack ~(keystone_admin)]#
创建虚拟机之前的最后一步,更新默认安全组,添加icmp和ssh入口规则,在网络选项卡下单击“安全组”,单击“管理规则”,然后单击“添加规则”。