5.2. 将子端口添加到中继
在 OpenShift 上的 Red Hat OpenStack Services (RHOSO)环境中,创建中继后,使实例 VLAN 感知为创建一个或多个子端口。子端口是中继父端口的子项。
先决条件
-
管理员已为您创建一个项目,并为您提供了一个
clouds.yaml
文件来访问云。 python-openstackclient
软件包驻留在您的工作站上。dnf list installed python-openstackclient
$ dnf list installed python-openstackclient
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 在网络上关联了一个中继,它连接到您要提供对中继 VLAN 的访问的实例。
流程
确认为您的云设置了系统
OS_CLOUD
变量:echo $OS_CLOUD
$ echo $OS_CLOUD my_cloud
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 如果需要,重置变量:
export OS_CLOUD=my_other_cloud
$ export OS_CLOUD=my_other_cloud
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 作为替代方案,您可以在每次运行
openstack
命令时添加--os-cloud <cloud_name
> 选项指定云名称。获取父端口的 MAC 地址。
保留此名称,因为稍后您将需要它:
Example
openstack port show parent-trunk-port --max-width=72
$ openstack port show parent-trunk-port --max-width=72
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
+-------------------------+--------------------------------------------+ | Field | Value | +-------------------------+--------------------------------------------+ | admin_state_up | UP | | allowed_address_pairs | | | binding_host_id | | | binding_profile | | | binding_vif_details | | | binding_vif_type | unbound | | binding_vnic_type | normal | | created_at | 2024-09-25T20:18:40Z | | data_plane_status | None | | description | | | device_id | | | device_owner | | | device_profile | None | | dns_assignment | fqdn='host-10-0-0-236.openstacklocal.', | | | hostname='host-10-0-0-236', | | | ip_address='10.0.0.236' | | | fqdn='host-2002-c000-200-- | | | 64.openstacklocal.', | | | hostname='host-2002-c000-200--64', | | | ip_address='2002:c000:200::64' | | dns_domain | | | dns_name | | | extra_dhcp_opts | | | fixed_ips | ip_address='10.0.0.236', subnet_id='6745ed | | | d4-d15f-4971-89bf-70307b0ad2f1' | | | ip_address='2002:c000:200::64', subnet_id= | | | '49dda67d-814e-457b-b14b-77ef32935c0f' | | id | 530ff46e-b285-4ad7-a77a-7dca1fb9174d | | ip_allocation | immediate | | mac_address | fa:16:3e:0f:b8:cb | | name | parent-trunk-port | | network_id | bcdb3cc0-8c0b-4d2d-813c-e141bb97aa8f | | numa_affinity_policy | None | | port_security_enabled | True | | project_id | 24089d2fe1a94dd29ca2f665794fbe92 | | propagate_uplink_status | None | | qos_network_policy_id | None | | qos_policy_id | None | | resource_request | None | | revision_number | 1 | | security_group_ids | 9bf70539-31b0-47e5-a0ea-3ee409de0499 | | status | DOWN | | tags | | | trunk_details | {'trunk_id': | | | 'ef2aff85-9e51-43d4-ab28-2ab833f049b3', | | | 'sub_ports': []} | | updated_at | 2024-09-25T20:18:40Z | +-------------------------+--------------------------------------------+
+-------------------------+--------------------------------------------+ | Field | Value | +-------------------------+--------------------------------------------+ | admin_state_up | UP | | allowed_address_pairs | | | binding_host_id | | | binding_profile | | | binding_vif_details | | | binding_vif_type | unbound | | binding_vnic_type | normal | | created_at | 2024-09-25T20:18:40Z | | data_plane_status | None | | description | | | device_id | | | device_owner | | | device_profile | None | | dns_assignment | fqdn='host-10-0-0-236.openstacklocal.', | | | hostname='host-10-0-0-236', | | | ip_address='10.0.0.236' | | | fqdn='host-2002-c000-200-- | | | 64.openstacklocal.', | | | hostname='host-2002-c000-200--64', | | | ip_address='2002:c000:200::64' | | dns_domain | | | dns_name | | | extra_dhcp_opts | | | fixed_ips | ip_address='10.0.0.236', subnet_id='6745ed | | | d4-d15f-4971-89bf-70307b0ad2f1' | | | ip_address='2002:c000:200::64', subnet_id= | | | '49dda67d-814e-457b-b14b-77ef32935c0f' | | id | 530ff46e-b285-4ad7-a77a-7dca1fb9174d | | ip_allocation | immediate | | mac_address | fa:16:3e:0f:b8:cb | | name | parent-trunk-port | | network_id | bcdb3cc0-8c0b-4d2d-813c-e141bb97aa8f | | numa_affinity_policy | None | | port_security_enabled | True | | project_id | 24089d2fe1a94dd29ca2f665794fbe92 | | propagate_uplink_status | None | | qos_network_policy_id | None | | qos_policy_id | None | | resource_request | None | | revision_number | 1 | | security_group_ids | 9bf70539-31b0-47e5-a0ea-3ee409de0499 | | status | DOWN | | tags | | | trunk_details | {'trunk_id': | | | 'ef2aff85-9e51-43d4-ab28-2ab833f049b3', | | | 'sub_ports': []} | | updated_at | 2024-09-25T20:18:40Z | +-------------------------+--------------------------------------------+
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 为中继创建父端口的子端口。
Example
在本例中,创建了一个端口
subport1
。通过指定分配给父端口的 MAC 地址fa:16:3e:33:c4:75
,创建的端口成为父端口的子端口:openstack port create --network private --mac-address fa:16:3e:33:c4:75 subport1
$ openstack port create --network private --mac-address fa:16:3e:33:c4:75 subport1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
+-------------------------+--------------------------------------------+ | Field | Value | +-------------------------+--------------------------------------------+ | admin_state_up | UP | | allowed_address_pairs | | | binding_host_id | | | binding_profile | | | binding_vif_details | | | binding_vif_type | unbound | | binding_vnic_type | normal | | created_at | 2024-09-25T20:19:28Z | | data_plane_status | None | | description | | | device_id | | | device_owner | | | device_profile | None | | dns_assignment | fqdn='host-10-0-24-31.openstacklocal.', | | | hostname='host-10-0-24-31', | | | ip_address='10.0.24.31' | | dns_domain | | | dns_name | | | extra_dhcp_opts | | | fixed_ips | ip_address='10.0.24.31', subnet_id='47d34c | | | f0-0dd2-49bd-a985-67311d80c5c4' | | id | 4ce8382f-5efc-4794-83f8-1f89ef7efe68 | | ip_allocation | immediate | | mac_address | fa:16:3e:0f:b8:cb | | name | subport1 | | network_id | 317be3d3-5265-43f7-b52b-930e3fd19b8b | | numa_affinity_policy | None | | port_security_enabled | True | | project_id | 24089d2fe1a94dd29ca2f665794fbe92 | | propagate_uplink_status | None | | qos_network_policy_id | None | | qos_policy_id | None | | resource_request | None | | revision_number | 1 | | security_group_ids | 9bf70539-31b0-47e5-a0ea-3ee409de0499 | | status | DOWN | | tags | | | trunk_details | None | | updated_at | 2024-09-25T20:19:28Z | +-------------------------+--------------------------------------------+
+-------------------------+--------------------------------------------+ | Field | Value | +-------------------------+--------------------------------------------+ | admin_state_up | UP | | allowed_address_pairs | | | binding_host_id | | | binding_profile | | | binding_vif_details | | | binding_vif_type | unbound | | binding_vnic_type | normal | | created_at | 2024-09-25T20:19:28Z | | data_plane_status | None | | description | | | device_id | | | device_owner | | | device_profile | None | | dns_assignment | fqdn='host-10-0-24-31.openstacklocal.', | | | hostname='host-10-0-24-31', | | | ip_address='10.0.24.31' | | dns_domain | | | dns_name | | | extra_dhcp_opts | | | fixed_ips | ip_address='10.0.24.31', subnet_id='47d34c | | | f0-0dd2-49bd-a985-67311d80c5c4' | | id | 4ce8382f-5efc-4794-83f8-1f89ef7efe68 | | ip_allocation | immediate | | mac_address | fa:16:3e:0f:b8:cb | | name | subport1 | | network_id | 317be3d3-5265-43f7-b52b-930e3fd19b8b | | numa_affinity_policy | None | | port_security_enabled | True | | project_id | 24089d2fe1a94dd29ca2f665794fbe92 | | propagate_uplink_status | None | | qos_network_policy_id | None | | qos_policy_id | None | | resource_request | None | | revision_number | 1 | | security_group_ids | 9bf70539-31b0-47e5-a0ea-3ee409de0499 | | status | DOWN | | tags | | | trunk_details | None | | updated_at | 2024-09-25T20:19:28Z | +-------------------------+--------------------------------------------+
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意如果您收到
HttpException: Conflict
错误,请确认您要在不同网络上创建子端口,到具有父中继端口的子端口。本例使用 public 网络作为父中继端口,对子端口使用 private。将端口与中继关联。
Example
在本例中,
subport1
与trunk1
关联。segmentation 类型是vlan
,分段 ID (VLAN ID)是55
。类型和 ID 是网络(专用
)中的属性,用于在前面的命令中创建子端口1
:openstack network trunk set --subport port=subport1,\ segmentation-type=vlan,segmentation-id=55 trunk1
$ openstack network trunk set --subport port=subport1,\ segmentation-type=vlan,segmentation-id=55 trunk1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
后续步骤