OpenStack creates a cloud host and connects to CRT

OpenStackT version creates a cloud host and connects to CRT

Command line operation

(1) Create a mirror

Load the environment variables of admin user

source admin-openrc.sh

Create image

[root@controller ~]# openstack image create --disk-format qcow2 --container-format bare --file /opt/iaas/images/cirros-0.3.4-x86_64-disk.img cirros
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field            | Value                                                                                                                                                                                      |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6                                                                                                                                                           |
| container_format | bare                                                                                                                                                                                       |
| created_at       | 2023-09-18T09:28:12Z                                                                                                                                                                       |
| disk_format      | qcow2                                                                                                                                                                                      |
| file             | /v2/images/14b16679-354c-4a3c-810c-72506e859378/file                                                                                                                                       |
| id               | 14b16679-354c-4a3c-810c-72506e859378                                                                                                                                                       |
| min_disk         | 0                                                                                                                                                                                          |
| min_ram          | 0                                                                                                                                                                                          |
| name             | cirros                                                                                                                                                                                     |
| owner            | 4f87bd1fe5e2469f81232a201b136a94                                                                                                                                                           |
| properties       | os_hash_algo='sha512', os_hash_value='1b03ca1bc3fafe448b90583c12f367949f8b0e665685979d95b004e48574b953316799e23240f4f739d1b5eb4c4ca24d38fdc6f4f9d8247a2bc64db25d6bbdb2', os_hidden='False' |
| protected        | False                                                                                                                                                                                      |
| schema           | /v2/schemas/image                                                                                                                                                                          |
| size             | 13287936                                                                                                                                                                                   |
| status           | active                                                                                                                                                                                     |
| tags             |                                                                                                                                                                                            |
| updated_at       | 2023-09-18T09:28:12Z                                                                                                                                                                       |
| virtual_size     | None                                                                                                                                                                                       |
| visibility       | shared                                                                                                                                                                                     |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

(2) Create an instance

[root@controller ~]# openstack flavor create --disk 20 --ram 2048 --vcpus 2 --id 66 f1
+----------------------------+-------+
| Field                      | Value |
+----------------------------+-------+
| OS-FLV-DISABLED:disabled   | False |
| OS-FLV-EXT-DATA:ephemeral  | 0     |
| disk                       | 20    |
| id                         | 66    |
| name                       | f1    |
| os-flavor-access:is_public | True  |
| properties                 |       |
| ram                        | 2048  |
| rxtx_factor                | 1.0   |
| swap                       |       |
| vcpus                      | 2     |
+----------------------------+-------+

(3) Create a network

Create intranet

[root@controller ~]#  openstack network create  --internal   int-net
+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field                     | Value                                                                                                                                                |
+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| admin_state_up            | UP                                                                                                                                                   |
| availability_zone_hints   |                                                                                                                                                      |
| availability_zones        |                                                                                                                                                      |
| created_at                | 2023-09-18T09:28:51Z                                                                                                                                 |
| description               |                                                                                                                                                      |
| dns_domain                | None                                                                                                                                                 |
| id                        | 56c46a33-bdcc-4cee-9320-1f4fa2186d59                                                                                                                 |
| ipv4_address_scope        | None                                                                                                                                                 |
| ipv6_address_scope        | None                                                                                                                                                 |
| is_default                | False                                                                                                                                                |
| is_vlan_transparent       | None                                                                                                                                                 |
| location                  | cloud='', project.domain_id=, project.domain_name='demo', project.id='4f87bd1fe5e2469f81232a201b136a94', project.name='admin', region_name='', zone= |
| mtu                       | 1450                                                                                                                                                 |
| name                      | int-net                                                                                                                                              |
| port_security_enabled     | True                                                                                                                                                 |
| project_id                | 4f87bd1fe5e2469f81232a201b136a94                                                                                                                     |
| provider:network_type     | vxlan                                                                                                                                                |
| provider:physical_network | None                                                                                                                                                 |
| provider:segmentation_id  | 2                                                                                                                                                    |
| qos_policy_id             | None                                                                                                                                                 |
| revision_number           | 1                                                                                                                                                    |
| router:external           | Internal                                                                                                                                             |
| segments                  | None                                                                                                                                                 |
| shared                    | False                                                                                                                                                |
| status                    | ACTIVE                                                                                                                                               |
| subnets                   |                                                                                                                                                      |
| tags                      |                                                                                                                                                      |
| updated_at                | 2023-09-18T09:28:51Z                                                                                                                                 |
+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+

Create an intranet subnet

[root@controller ~]# openstack subnet create  --allocation-pool start=10.0.0.100,end=10.0.0.200 --network int-net --gateway 10.0.0.1  --subnet-range 10.0.0.0/24 int-sub
+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field             | Value                                                                                                                                                |
+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| allocation_pools  | 10.0.0.100-10.0.0.200                                                                                                                                |
| cidr              | 10.0.0.0/24                                                                                                                                          |
| created_at        | 2023-09-18T09:28:58Z                                                                                                                                 |
| description       |                                                                                                                                                      |
| dns_nameservers   |                                                                                                                                                      |
| enable_dhcp       | True                                                                                                                                                 |
| gateway_ip        | 10.0.0.1                                                                                                                                             |
| host_routes       |                                                                                                                                                      |
| id                | decd6a73-b68c-4011-877e-ca2006954aa6                                                                                                                 |
| ip_version        | 4                                                                                                                                                    |
| ipv6_address_mode | None                                                                                                                                                 |
| ipv6_ra_mode      | None                                                                                                                                                 |
| location          | cloud='', project.domain_id=, project.domain_name='demo', project.id='4f87bd1fe5e2469f81232a201b136a94', project.name='admin', region_name='', zone= |
| name              | int-sub                                                                                                                                              |
| network_id        | 56c46a33-bdcc-4cee-9320-1f4fa2186d59                                                                                                                 |
| prefix_length     | None                                                                                                                                                 |
| project_id        | 4f87bd1fe5e2469f81232a201b136a94                                                                                                                     |
| revision_number   | 0                                                                                                                                                    |
| segment_id        | None                                                                                                                                                 |
| service_types     |                                                                                                                                                      |
| subnetpool_id     | None                                                                                                                                                 |
| tags              |                                                                                                                                                      |
| updated_at        | 2023-09-18T09:28:58Z                                                                                                                                 |
+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+

Create extranet

[root@controller ~]# openstack network create --provider-network-type flat  --provider-physical-network   provider --external  --share ext-net
+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field                     | Value                                                                                                                                                |
+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| admin_state_up            | UP                                                                                                                                                   |
| availability_zone_hints   |                                                                                                                                                      |
| availability_zones        |                                                                                                                                                      |
| created_at                | 2023-09-18T09:29:06Z                                                                                                                                 |
| description               |                                                                                                                                                      |
| dns_domain                | None                                                                                                                                                 |
| id                        | 2aad11ac-a91a-4ccd-99b9-de3a2c69c386                                                                                                                 |
| ipv4_address_scope        | None                                                                                                                                                 |
| ipv6_address_scope        | None                                                                                                                                                 |
| is_default                | False                                                                                                                                                |
| is_vlan_transparent       | None                                                                                                                                                 |
| location                  | cloud='', project.domain_id=, project.domain_name='demo', project.id='4f87bd1fe5e2469f81232a201b136a94', project.name='admin', region_name='', zone= |
| mtu                       | 1500                                                                                                                                                 |
| name                      | ext-net                                                                                                                                              |
| port_security_enabled     | True                                                                                                                                                 |
| project_id                | 4f87bd1fe5e2469f81232a201b136a94                                                                                                                     |
| provider:network_type     | flat                                                                                                                                                 |
| provider:physical_network | provider                                                                                                                                             |
| provider:segmentation_id  | None                                                                                                                                                 |
| qos_policy_id             | None                                                                                                                                                 |
| revision_number           | 1                                                                                                                                                    |
| router:external           | External                                                                                                                                             |
| segments                  | None                                                                                                                                                 |
| shared                    | True                                                                                                                                                 |
| status                    | ACTIVE                                                                                                                                               |
| subnets                   |                                                                                                                                                      |
| tags                      |                                                                                                                                                      |
| updated_at                | 2023-09-18T09:29:06Z                                                                                                                                 |
+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+

Create an external subnet

[root@controller ~]# openstack subnet create  --allocation-pool start=192.168.200.100,end=192.168.200.200 --network ext-net --gateway 192.168.200.2  --subnet-range 192.168.200.0/24 ext-sub
+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field             | Value                                                                                                                                                |
+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| allocation_pools  | 192.168.200.100-192.168.200.200                                                                                                                      |
| cidr              | 192.168.200.0/24                                                                                                                                     |
| created_at        | 2023-09-18T09:29:12Z                                                                                                                                 |
| description       |                                                                                                                                                      |
| dns_nameservers   |                                                                                                                                                      |
| enable_dhcp       | True                                                                                                                                                 |
| gateway_ip        | 192.168.200.2                                                                                                                                        |
| host_routes       |                                                                                                                                                      |
| id                | cfc2d24a-09f3-4786-a699-9e320ef6454f                                                                                                                 |
| ip_version        | 4                                                                                                                                                    |
| ipv6_address_mode | None                                                                                                                                                 |
| ipv6_ra_mode      | None                                                                                                                                                 |
| location          | cloud='', project.domain_id=, project.domain_name='demo', project.id='4f87bd1fe5e2469f81232a201b136a94', project.name='admin', region_name='', zone= |
| name              | ext-sub                                                                                                                                              |
| network_id        | 2aad11ac-a91a-4ccd-99b9-de3a2c69c386                                                                                                                 |
| prefix_length     | None                                                                                                                                                 |
| project_id        | 4f87bd1fe5e2469f81232a201b136a94                                                                                                                     |
| revision_number   | 0                                                                                                                                                    |
| segment_id        | None                                                                                                                                                 |
| service_types     |                                                                                                                                                      |
| subnetpool_id     | None                                                                                                                                                 |
| tags              |                                                                                                                                                      |
| updated_at        | 2023-09-18T09:29:12Z                                                                                                                                 |
+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+

(4) Create a security group

Create a security group

[root@controller ~]# openstack security group create group
+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field           | Value                                                                                                                                                 |
+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
| created_at      | 2023-09-18T09:30:36Z                                                                                                                                  |
| description     | group                                                                                                                                                 |
| id              | 388476f1-1cf1-46c3-8d2a-8e346aee3600                                                                                                                  |
| location        | cloud='', project.domain_id=, project.domain_name='demo', project.id='4f87bd1fe5e2469f81232a201b136a94', project.name='admin', region_name='', zone=  |
| name            | group                                                                                                                                                 |
| project_id      | 4f87bd1fe5e2469f81232a201b136a94                                                                                                                      |
| revision_number | 1                                                                                                                                                     |
| rules           | created_at='2023-09-18T09:30:36Z', direction='egress', ethertype='IPv6', id='93d39c18-4735-4eb8-97b6-edafa3f91029', updated_at='2023-09-18T09:30:36Z' |
|                 | created_at='2023-09-18T09:30:36Z', direction='egress', ethertype='IPv4', id='a2fc2876-eb44-4ed9-a728-a892d46b37a5', updated_at='2023-09-18T09:30:36Z' |
| tags            | []                                                                                                                                                    |
| updated_at      | 2023-09-18T09:30:36Z                                                                                                                                  |
+-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+

Release all icmp entrances and exits

[root@controller ~]# openstack security group rule create --ingress --protocol icmp group
[root@controller ~]# openstack security group rule create --egress --protocol icmp group

Release all tcp entrances and exits

[root@controller ~]# openstack security group rule create --ingress --protocol tcp group 
[root@controller ~]# openstack security group rule create --egress --protocol tcp group  

Release all udp entrances and exits

[root@controller ~]# openstack security group rule create --ingress --protocol udp group 
[root@controller ~]# openstack security group rule create --egress --protocol udp group  

(5) Create route

[root@controller ~]# openstack router create router
[root@controller ~]# openstack router set  --external-gateway  ext-net router
[root@controller ~]# openstack router add subnet router int-sub

(6) Create a cloud host

[root@controller ~]# openstack server create  --image cirros --flavor 66 --network int-net --security-group group server1            
+-------------------------------------+-----------------------------------------------+
| Field                               | Value                                         |
+-------------------------------------+-----------------------------------------------+
| OS-DCF:diskConfig                   | MANUAL                                        |
| OS-EXT-AZ:availability_zone         |                                               |
| OS-EXT-SRV-ATTR:host                | None                                          |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None                                          |
| OS-EXT-SRV-ATTR:instance_name       |                                               |
| OS-EXT-STS:power_state              | NOSTATE                                       |
| OS-EXT-STS:task_state               | scheduling                                    |
| OS-EXT-STS:vm_state                 | building                                      |
| OS-SRV-USG:launched_at              | None                                          |
| OS-SRV-USG:terminated_at            | None                                          |
| accessIPv4                          |                                               |
| accessIPv6                          |                                               |
| addresses                           |                                               |
| adminPass                           | k9NCCHbqJxAA                                  |
| config_drive                        |                                               |
| created                             | 2023-09-18T09:32:35Z                          |
| flavor                              | f1 (66)                                       |
| hostId                              |                                               |
| id                                  | bc9a8506-d2e8-4357-9a9e-6f691c0e6ac8          |
| image                               | cirros (14b16679-354c-4a3c-810c-72506e859378) |
| key_name                            | None                                          |
| name                                | server1                                       |
| progress                            | 0                                             |
| project_id                          | 4f87bd1fe5e2469f81232a201b136a94              |
| properties                          |                                               |
| security_groups                     | name='388476f1-1cf1-46c3-8d2a-8e346aee3600'   |
| status                              | BUILD                                         |
| updated                             | 2023-09-18T09:32:36Z                          |
| user_id                             | 25ac2dd543554ccfbea43aabbd23182c              |
| volumes_attached                    |                                               |
+-------------------------------------+-----------------------------------------------+

View cloud hosts

[root@controller ~]# openstack server list
+--------------------------------------+---------+--------+--------------------+--------+--------+
| ID                                   | Name    | Status | Networks           | Image  | Flavor |
+--------------------------------------+---------+--------+--------------------+--------+--------+
| bc9a8506-d2e8-4357-9a9e-6f691c0e6ac8 | server1 | ACTIVE | int-net=10.0.0.194 | cirros | f1     |
+--------------------------------------+---------+--------+--------------------+--------+--------+

(7) Bind floating IP

First create a floating IP

[root@controller ~]# openstack floating ip create ext-net
+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field               | Value                                                                                                                                                                           |
+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| created_at          | 2023-09-18T09:33:13Z                                                                                                                                                            |
| description         |                                                                                                                                                                                 |
| dns_domain          | None                                                                                                                                                                            |
| dns_name            | None                                                                                                                                                                            |
| fixed_ip_address    | None                                                                                                                                                                            |
| floating_ip_address | 192.168.200.117                                                                                                                                                                 |
| floating_network_id | 2aad11ac-a91a-4ccd-99b9-de3a2c69c386                                                                                                                                            |
| id                  | 53a4d0ca-2213-4162-baf4-75ba1c1d3ded                                                                                                                                            |
| location            | Munch({
    
    'project': Munch({
    
    'domain_name': 'demo', 'domain_id': None, 'name': 'admin', 'id': u'4f87bd1fe5e2469f81232a201b136a94'}), 'cloud': '', 'region_name': '', 'zone': None}) |
| name                | 192.168.200.117                                                                                                                                                                 |
| port_details        | None                                                                                                                                                                            |
| port_id             | None                                                                                                                                                                            |
| project_id          | 4f87bd1fe5e2469f81232a201b136a94                                                                                                                                                |
| qos_policy_id       | None                                                                                                                                                                            |
| revision_number     | 0                                                                                                                                                                               |
| router_id           | None                                                                                                                                                                            |
| status              | DOWN                                                                                                                                                                            |
| subnet_id           | None                                                                                                                                                                            |
| tags                | []                                                                                                                                                                              |
| updated_at          | 2023-09-18T09:33:13Z                                                                                                                                                            |
+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Bind the floating IP to the cloud host

[root@controller ~]# openstack server add floating ip server1 192.168.200.117

View cloud hosts

[root@controller ~]# openstack server list
+--------------------------------------+---------+--------+-------------------------------------+--------+--------+
| ID                                   | Name    | Status | Networks                            | Image  | Flavor |
+--------------------------------------+---------+--------+-------------------------------------+--------+--------+
| bc9a8506-d2e8-4357-9a9e-6f691c0e6ac8 | server1 | ACTIVE | int-net=10.0.0.194, 192.168.200.117 | cirros | f1     |
+--------------------------------------+---------+--------+-------------------------------------+--------+--------+

The cloud host and the local machine are interoperable

image-20230918173421208

(8) Log in to the cloud host

First check the console url address

[root@controller ~]# openstack console url show server1
+-------+-----------------------------------------------------------------------------------------------+
| Field | Value                                                                                         |
+-------+-----------------------------------------------------------------------------------------------+
| type  | novnc                                                                                         |
| url   | http://192.168.100.10:6080/vnc_auto.html?path=%3Ftoken%3D73cce687-a2f2-4318-9a24-ce7af1c46149 |
+-------+-----------------------------------------------------------------------------------------------+

web access

Account: cirros

Password: cubswin:)

image-20230918173513981

See if you can ping the controller and compute

image-20230918173707753

(9) CRT connection

image-20230918173900671

Graphical operation

(1) Create a mirror

first step:

①Project>>②Compute>>③Image>>④Create image

image-20230918175422955

Step two:

image-20230918175638224

third step:

image-20230918175707266

(2) Create an instance

first step:

①Administrator>②Compute>③Instance Type>④Create Instance Type

image-20230918175928760

Step two:

image-20230918180058710

third step:

image-20230918180120941

(3) Create a network

Create intranet

first step:

①Project>②Network>③Network>④Create network

image-20230918180832898

Step two:

image-20230918180329366

third step:

image-20230918180432996

the fourth step:

image-20230918180510724

the fifth step:

image-20230918180526821

Create extranet

first step:

①Administrator>②Network>③Network>④Create network

image-20230918180754993

Step two:

image-20230918180917013

the fourth step:

image-20230918184403433

the fifth step:

image-20230918181021797

Step 6:

image-20230918181119599

(4) Create a security group

first step:

①Project>②Network>③Security Group>④Create Security Group

image-20230918181223999

Step two:

image-20230918181241789

third step:

image-20230918181301031

the fourth step:

Add all ICMP all TCP all UDP ingress and egress

image-20230918181430535

(5) Create route

first step:

①Project>②Network>③Routing>④New route

image-20230918181543120

Step two:

image-20230918181607844

third step:

image-20230918181635790

the fourth step:

image-20230918181700950

the fifth step:

image-20230918181732004

Step 6:

image-20230918182140082

(6) Create a cloud host

first step:

①Project>②Calculation>③Instance>④Create instance

image-20230918182306015

Step two:

image-20230918182403692

third step:

image-20230918182426380

the fourth step:

image-20230918182451384

the fifth step:

image-20230918182516798

Step 6:

image-20230918182553101

Step 7:

image-20230918182714464

(7) Bind floating IP

first step:

Bind the created cloud host to a floating IP

image-20230918182812912

Step two:

image-20230918182849442

third step:

image-20230918182914491

the fourth step:

image-20230918182935683

the fifth step:

image-20230918183000166

(8) Log in to the cloud host

first step:

image-20230918183032801

Step two:

image-20230918183111015

Guess you like

Origin blog.csdn.net/qq_52089863/article/details/132988953