How to Create One VIP to Switch Contents Between Two Layer 4 Ports
Background
This article explains how to create one virtual service to switch contents between two Layer 4 ports. Use the Layer 4 port switching feature on a Layer 4 virtual service to if there are two VIPs listening on two different ports.
Instructions
To create a single virtual service listening to two different ports (port X and port Y), create two pools – pool-X and pool-Y and add the servers to these pools.
Log in to the Avi CLI and use the configure virtualservice <virtual-service name>
to map one virtual services to two pools listening on two different ports.
Note: This option is not available on Avi user interface.
- Creating a virtual service, and a pool to listen to port number X
[admin:AviCloudController]: configure virtualservice L4-Test-VS
[admin:AviCloudControllert]: virtualservice> service_pool_select
New object being created
[admin:AviCloudController]: virtualservice:service_pool_select> service_port x service_pool_ref pool-x service_protocol protocol_type_udp_fast_path
[admin:AviCloudController]: virtualservice:service_pool_select> where
Tenant: admin
-----------------------------------------+
Field Value
-----------------------------------------+
service_port x
service_pool_ref pool-x
service_protocol PROTOCOL_TYPE_UDP_FAST_PATH
-----------------------------------------+
[admin:AviCloudController]: virtualservice:service_pool_select> save
- Creating a virtual service, and a pool to listen to port number Y
[admin:AviCloudController]: virtualservice> service_pool_select
New object being created
[admin:AviCloudController]: virtualservice:service_pool_select> service_port y service_pool_ref pool-y service_protocol protocol_type_udp_fast_path
[admin:AviCloudController]: virtualservice:service_pool_select> where
Tenant: admin
-----------------------------------------+
Field Value
-----------------------------------------+
service_port 5141
service_pool_ref pool-5141
service_protocol PROTOCOL_TYPE_UDP_FAST_PATH
-----------------------------------------+
[admin:AviCloudController]: virtualservice:service_pool_select> save
[admin:AviCloudController]: virtualservice> save