Get the App
SLTechnology News&Howtos  ›  Servers  › 

Example Analysis of specifying ip address on the Command Line of Openstack Virtual Machine for Pike

Shulou Source: shulou.com Published: 2022-06-01 02:21:19 11月14日 Update

Pike version of Openstack virtual machine command line specified ip address example analysis, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

View the existing network interface (corresponding to the virtual machine Nic)

#. Admin-openrc

By viewing admin permissions, you can see more tenant id tenant_id.

# neutron port-listneutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.+--+-+--+-+- -+ | id | name | tenant_id | mac_address | fixed_ips | | +-- +-- -+-+ | 00401677-543c-4834-9f30-d25e179e88a0 | | 9c658f84358140378e637f0b27c7ca57 | | fa:16:3e:e0:d1:c2 | {"subnet_id": "c26fc89c-44ce-492b-aa88-befe9bae942c" | "ip_address": "172.16.40.134"} | | e6480311-3226-49fc-8964-a15237d6ff14 | | 9c658f84358140378e637f0b27c7ca57 | fa:16:3e:67:01:eb | {"subnet_id": "c26fc89c-44ce-492b-aa88-befe9bae942c" "ip_address": "172.16.40.108"} | +-- +-+ -+

The average tenant cannot see the tenant id.

#. Tbg-openrc # neutron port-listneutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.+--+ -- + | id | name | mac_address | fixed_ips | +- -+- -+ | 00401677-543c-4834-9f30-d25e179e88a0 | | fa:16:3e:e0:d1:c2 | {"subnet_id": "c26fc89c-44ce-492b-aa88-befe9bae942c" "ip_address": "172.16.40.134"} | | e6480311-3226-49fc-8964-a15237d6ff14 | | fa:16:3e:67:01:eb | {"subnet_id": "c26fc89c-44ce-492b-aa88-befe9bae942c" "ip_address": "172.16.40.108"} | +-- -- +

Create a network interface with admin permission to specify the tenant, the ip address, and the corresponding network

#. Admin-openrc # neutron port-create-tenant-id 9c658f84358140378e637f0b27c7ca57-fixed-ip ip_address='172.16.40.104' providerneutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.Created a new port:+---+- -+ | Field | Value | + -+ | admin_state_up | True | | allowed_address_pairs | | | binding:host_id | binding:profile | {} | | | binding:vif_details | {} | | binding:vif_type | unbound | | binding:vnic_type | normal | | | created_at | 2018-02-27T07:42:08Z | | description | | | device_id | device_owner | Extra_dhcp_opts | | fixed_ips | {"subnet_id": "c26fc89c-44ce-492b-aa88-befe9bae942c" "ip_address": "172.16.40.104"} | | id | 5e993bfd-219b-4e0e-9173-721e072e7342 | | mac_address | fa:16:3e:d8:40:0a | | name | | network_id | c35672ab-6d14-4fd6-99a5-5b912ae1070a | | port_security_enabled | True | | | project_id | 9c658f84358140378e637f0b27c7ca57 | | revision_number | 3 | | security_groups | e437d647-4c0e- 42c4-bc40-f15d15364748 | | status | DOWN | | tags | | | tenant_id | 9c658f84358140378e637f0b27c7ca57 | | updated_at | 2018-02-27T07:42:08Z | +- -+

Connect the newly created port to the virtual machine

# nova list+--+----+ | ID | | Name | Status | Task State | Power State | Networks | +-- -+-+ | eddcb46e-eac5-4403-83a8-1f0d8ac34439 | hadoop-4 | ACTIVE |-| Running | provider=172.16.40.134 | | 06a43249-9258-409e-b791-541396771a9d | zxq-3 | ACTIVE |-| Running | provider=172.16.40.108 | +- -+

Add a connection, and if you do not specify a port-id, you will create a new

# nova interface-attach-- port-id 5e993bfd-219b-4e0e-9173-721e072e7342 eddcb46e-eac5-4403-83a8-1f0d8ac34439# nova interface-list eddcb46e-eac5-4403-83a8-1f0d8ac34439 -+ | Port State | Port ID | Net ID | IP addresses | MAC Addr | +-+- -- +-+ | BUILD | 00401677-543c-4834-9f30-d25e179e88a0 | c35672ab- 6d14-4fd6-99a5-5b912ae1070a | 172.16.40.134 | fa:16:3e:e0:d1:c2 | | BUILD | 5e993bfd-219b-4e0e-9173-721e072e7342 | c35672ab-6d14-4fd6-99a5-5b912ae1070a | 172.16.40.104 | fa:16:3e:d8:40:0a | +-- -+-+

Detach interface

# nova interface-detach eddcb46e-eac5-4403-83a8-1f0d8ac34439 00401677-543c-4834-9f30-d25e179e88a0# ping 172.16.40.104PING 172.16.40.104 (172.16.40.104) 56 (84) bytes of data.64 bytes from 172.16.40.104: icmp_seq=1 ttl=64 time=3.11 ms

Can ping, add the specified ip is normal.

This is the answer to the sample analysis question about the ip address specified by the command line of the Pike version of Openstack virtual machine. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Tags: Tenant address analysis interface network questions commands examples more permissions help answers easy ordinary easy content guys partners methods knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker OPPO Reno macOS Microsoft Xiaomi