This topic explains creating one virtual service to switch contents between two Layer 4 ports. Use the Layer 4 port switching feature on a Layer 4 virtual service if there are two VIPs listening on two different ports.
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 into the Avi Load Balancer CLI and use the configure virtualservice <virtual-service name>
to map one virtual service to two pools listening on two different ports.
Note:
This option is only supported through the CLI.
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