点击提供者网络
[root@controller ~]# neutron net-create --shared --provider:physical_network provider \
> --provider:network_type flat provider
Created a new network:
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2021-07-29T16:11:40 |
| description | |
| id | 1b9b6ccc-a8ee-44ce-a2fe-bc9394d54bef |
| ipv4_address_scope | |
| ipv6_address_scope | |
| mtu | 1500 |
| name | provider |
| port_security_enabled | True |
| provider:network_type | flat |
| provider:physical_network | provider |
| provider:segmentation_id | |
| router:external | False |
| shared | True |
| status | ACTIVE |
| subnets | |
| tags | |
| tenant_id | 93e8c2ef36d745048542fd3611bf1a4f |
| updated_at | 2021-07-29T16:11:40 |
+---------------------------+--------------------------------------+
[root@controller ~]# neutron subnet-create --name provider --allocation-pool start=172.25.138.100,end=172.25.138.200 --dns-nameserver 114.114.114.114 --gateway 172.25.138.250 provider 172.25.138.0/24
Created a new subnet:
+-------------------+------------------------------------------------------+
| Field | Value |
+-------------------+------------------------------------------------------+
| allocation_pools | {"start": "172.25.138.100", "end": "172.25.138.200"} |
| cidr | 172.25.138.0/24 |
| created_at | 2021-07-29T16:16:46 |
| description | |
| dns_nameservers | 114.114.114.114 |
| enable_dhcp | True |
| gateway_ip | 172.25.138.250 |
| host_routes | |
| id | c4cdaea1-f07c-43a3-8781-63dcaadec524 |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | provider |
| network_id | 1b9b6ccc-a8ee-44ce-a2fe-bc9394d54bef |
| subnetpool_id | |
| tenant_id | 93e8c2ef36d745048542fd3611bf1a4f |
| updated_at | 2021-07-29T16:16:46 |
+-------------------+------------------------------------------------------+
[root@controller ~]# openstack flavor create --id 0 --vcpus 1 --ram 64 --disk 1 m1.nano
+----------------------------+---------+
| Field | Value |
+----------------------------+---------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 1 |
| id | 0 |
| name | m1.nano |
| os-flavor-access:is_public | True |
| ram | 64 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 1 |
+----------------------------+---------+
[root@controller ~]# openstack flavor list
+----+-----------+-------+------+-----------+-------+-----------+
| ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+-------+------+-----------+-------+-----------+
| 0 | m1.nano | 64 | 1 | 0 | 1 | True |
| 1 | m1.tiny | 512 | 1 | 0 | 1 | True |
| 2 | m1.small | 2048 | 20 | 0 | 1 | True |
| 3 | m1.medium | 4096 | 40 | 0 | 2 | True |
| 4 | m1.large | 8192 | 80 | 0 | 4 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | 8 | True |
+----+-----------+-------+------+-----------+-------+-----------+
[root@controller ~]# soucr demo-openrc
-bash: soucr: command not found
[root@controller ~]# cd
[root@controller ~]# source demo-openrc
[root@controller ~]# ssh-keygen -q -N ""
Enter file in which to save the key (/root/.ssh/id_rsa):
[root@controller ~]# openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey
+-------------+-------------------------------------------------+
| Field | Value |
+-------------+-------------------------------------------------+
| fingerprint | 06:b6:c1:e9:87:dc:19:55:c8:8f:8d:18:80:8d:4a:cf |
| name | mykey |
| user_id | e4effbf5ec7f4365947cb9471b56e64b |
+-------------+-------------------------------------------------+
[root@controller ~]# openstack keypair list
+-------+-------------------------------------------------+
| Name | Fingerprint |
+-------+-------------------------------------------------+
| mykey | 06:b6:c1:e9:87:dc:19:55:c8:8f:8d:18:80:8d:4a:cf |
+-------+-------------------------------------------------+
点开公有网络
[root@controller ~]# openstack flavor list
+----+-----------+-------+------+-----------+-------+-----------+
| ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+-------+------+-----------+-------+-----------+
| 0 | m1.nano | 64 | 1 | 0 | 1 | True |
| 1 | m1.tiny | 512 | 1 | 0 | 1 | True |
| 2 | m1.small | 2048 | 20 | 0 | 1 | True |
| 3 | m1.medium | 4096 | 40 | 0 | 2 | True |
| 4 | m1.large | 8192 | 80 | 0 | 4 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | 8 | True |
+----+-----------+-------+------+-----------+-------+-----------+
[root@controller ~]#
[root@controller ~]# openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| 2453c88e-91bf-496c-9435-4ab30e970d09 | cirros | active |
+--------------------------------------+--------+--------+
[root@controller ~]# openstack network list
+--------------------------------------+----------+--------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+----------+--------------------------------------+
| 1b9b6ccc-a8ee-44ce-a2fe-bc9394d54bef | provider | c4cdaea1-f07c-43a3-8781-63dcaadec524 |
+--------------------------------------+----------+--------------------------------------+
[root@controller ~]# openstack security group list
+--------------------------------------+---------+------------------------+----------------------------------+
| ID | Name | Description | Project |
+--------------------------------------+---------+------------------------+----------------------------------+
| 71ec6279-2442-4f18-85e5-5536a56e8957 | default | Default security group | 4d1b36afe45f4a3dbf6d7fb63cbe9bda |
+--------------------------------------+---------+------------------------+----------------------------------+
下面创建需要这个表里面的内容 images network security
[root@controller ~]# openstack server create --flavor m1.nano --image cirros --nic net-id=1b9b6ccc-a8ee-44ce-a2fe-bc9394d54bef --security-group default --key-name mykey provider-instance
+--------------------------------------+-----------------------------------------------+
| Field | Value |
+--------------------------------------+-----------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | |
| OS-EXT-STS:power_state | 0 |
| 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 | 2oqtjrz4AGR8 |
| config_drive | |
| created | 2021-07-29T17:15:08Z |
| flavor | m1.nano (0) |
| hostId | |
| id | 133b7f3d-90ad-442b-baf6-dac7de974a54 |
| image | cirros (2453c88e-91bf-496c-9435-4ab30e970d09) |
| key_name | mykey |
| name | provider-instance |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| project_id | 4d1b36afe45f4a3dbf6d7fb63cbe9bda |
| properties | |
| security_groups | [{u'name': u'default'}] |
| status | BUILD |
| updated | 2021-07-29T17:15:09Z |
| user_id | e4effbf5ec7f4365947cb9471b56e64b |
+--------------------------------------+-----------------------------------------------+
[root@controller ~]# openstack server list
+--------------------------------------+-------------------+--------+-------------------------+
| ID | Name | Status | Networks |
+--------------------------------------+-------------------+--------+-------------------------+
| 133b7f3d-90ad-442b-baf6-dac7de974a54 | provider-instance | ACTIVE | provider=172.25.138.101 |
+--------------------------------------+-------------------+--------+-------------------------+
web访问
[root@controller ~]# openstack console url show provider-instance
+-------+---------------------------------------------------------------------------------+
| Field | Value |
+-------+---------------------------------------------------------------------------------+
| type | novnc |
| url | http://controller:6080/vnc_auto.html?token=1c6d79e2-64de-4d70-b98e-97d5bf8fbb47 |
+-------+---------------------------------------------------------------------------------+
访问这个http://controller:6080/vnc_auto.html?token=1c6d79e2-64de-4d70-b98e-97d5bf8fbb47