This section discusses the configuration to share a single VIP across multiple virtual services using the NSX Advanced Load Balancer CLI
Create the VsVip
object as follows:
admin@10-52-1-115:~$ shell Login: admin Password: [admin:10-52-1-115]: > configure vsvip shared-vsvip [admin:10-52-1-115]: vsvip> vip New object being created [admin:10-52-1-115]: vsvip:vip> vip_id 1 [admin:10-52-1-115]: vsvip:vip> ip_address 1.1.1.1 [admin:10-52-1-115]: vsvip:vip> enabled [admin:10-52-1-115]: vsvip:vip> discovered_networks New object being created [admin:10-52-1-115]: vsvip:vip:discovered_networks> network_ref pg-90 [admin:10-52-1-115]: vsvip:vip:discovered_networks> subnet 10.52.90.0/24 [admin:10-52-1-115]: vsvip:vip:discovered_networks> save [admin:10-52-1-115]: vsvip:vip> no auto_allocate_ip +------------------------+---------------+ | Field | Value | +------------------------+---------------+ | vip_id | 1 | | ip_address | 1.1.1.1 | | enabled | True | | discovered_networks[1] | | | network_ref | pg-90 | | subnet[1] | 10.52.90.0/24 | | auto_allocate_ip | False | +------------------------+---------------+ [admin:10-52-1-115]: vsvip:vip> no auto_allocate_floating_ip +---------------------------+---------------+ | Field | Value | +---------------------------+---------------+ | vip_id | 1 | | ip_address | 1.1.1.1 | | enabled | True | | discovered_networks[1] | | | network_ref | pg-90 | | subnet[1] | 10.52.90.0/24 | | auto_allocate_ip | False | | auto_allocate_floating_ip | False | +---------------------------+---------------+ [admin:10-52-1-115]: vsvip:vip> no avi_allocated_vip +---------------------------+---------------+ | Field | Value | +---------------------------+---------------+ | vip_id | 1 | | ip_address | 1.1.1.1 | | enabled | True | | discovered_networks[1] | | | network_ref | pg-90 | | subnet[1] | 10.52.90.0/24 | | auto_allocate_ip | False | | auto_allocate_floating_ip | False | | avi_allocated_vip | False | +---------------------------+---------------+ [admin:10-52-1-115]: vsvip:vip> no avi_allocated_fip +---------------------------+---------------+ | Field | Value | +---------------------------+---------------+ | vip_id | 1 | | ip_address | 1.1.1.1 | | enabled | True | | discovered_networks[1] | | | network_ref | pg-90 | | subnet[1] | 10.52.90.0/24 | | auto_allocate_ip | False | | auto_allocate_floating_ip | False | | avi_allocated_vip | False | | avi_allocated_fip | False | +---------------------------+---------------+ [admin:10-52-1-115]: vsvip:vip> auto_allocate_ip_type V4_ONLY [admin:10-52-1-115]: vsvip:vip> save [admin:10-52-1-115]: vsvip> dns_info New object being created [admin:10-52-1-115]: vsvip:dns_info> fqdn shared-vsvip.nmavi.local [admin:10-52-1-115]: vsvip:dns_info> ttl 30 [admin:10-52-1-115]: vsvip:dns_info> type DNS_RECORD_A [admin:10-52-1-115]: vsvip:dns_info> num_records_in_response 1 [admin:10-52-1-115]: vsvip:dns_info> algorithm DNS_RECORD_RESPONSE_CONSISTENT_HASH [admin:10-52-1-115]: vsvip:dns_info> save [admin:10-52-1-115]: vsvip> vrf_context_ref global [admin:10-52-1-115]: vsvip> no east_west_placement +-----------------------------+-------------------------------------+ | Field | Value | +-----------------------------+-------------------------------------+ | name | shared-vsvip | | vip[1] | | | vip_id | 1 | | ip_address | 1.1.1.1 | | enabled | True | | discovered_networks[1] | | | network_ref | pg-90 | | subnet[1] | 10.52.90.0/24 | | auto_allocate_ip | False | | auto_allocate_floating_ip | False | | avi_allocated_vip | False | | avi_allocated_fip | False | | auto_allocate_ip_type | V4_ONLY | | dns_info[1] | | | fqdn | shared-vsvip.nmavi.local | | ttl | 30 | | type | DNS_RECORD_A | | num_records_in_response | 1 | | algorithm | DNS_RECORD_RESPONSE_CONSISTENT_HASH | | vrf_context_ref | global | | east_west_placement | False | +-----------------------------+-------------------------------------+ [admin:10-52-1-115]: vsvip> tenant_ref admin [admin:10-52-1-115]: vsvip> cloud_ref Default-Cloud [admin:10-52-1-115]: vsvip> save +-----------------------------+--------------------------------------------+ | Field | Value | +-----------------------------+--------------------------------------------+ | uuid | vsvip-233f645c-693e-4e83-80b5-639c3f7198e6 | | name | shared-vsvip | | vip[1] | | | vip_id | 1 | | ip_address | 1.1.1.1 | | enabled | True | | discovered_networks[1] | | | network_ref | pg-90 | | subnet[1] | 10.52.90.0/24 | | auto_allocate_ip | False | | auto_allocate_floating_ip | False | | avi_allocated_vip | False | | avi_allocated_fip | False | | auto_allocate_ip_type | V4_ONLY | | dns_info[1] | | | fqdn | shared-vsvip.nmavi.local | | ttl | 30 | | type | DNS_RECORD_A | | num_records_in_response | 1 | | algorithm | DNS_RECORD_RESPONSE_CONSISTENT_HASH | | vrf_context_ref | global | | east_west_placement | False | | tenant_ref | admin | | cloud_ref | Default-Cloud | +-----------------------------+--------------------------------------------+
Configure the first virtual service as follows:
[admin:10-52-1-115]: > configure virtualservice vs-1 [admin:10-52-1-115]: virtualservice> services New object being created [admin:10-52-1-115]: virtualservice:services> port 80 [admin:10-52-1-115]: virtualservice:services> no enable_ssl +------------+-------+ | Field | Value | | port | 80 | | enable_ssl | False | +------------+-------+ [admin:10-52-1-115]: virtualservice:services> port_range_end 80 [admin:10-52-1-115]: virtualservice:services> save [admin:10-52-1-115]: virtualservice> vsvip_ref shared-vsvip [admin:10-52-1-115]: virtualservice> save +------------------------------------+-------------------------------------------------------------+ | Field | Value | +------------------------------------+-------------------------------------------------------------+ | uuid | virtualservice-57c4c559-e551-4a6b-9ebd-085937eb3887 | | name | vs-1 | | enabled | True | | services[1] | | | port | 80 | | enable_ssl | False | | port_range_end | 80 | | application_profile_ref | System-HTTP | | network_profile_ref | System-TCP-Proxy | | se_group_ref | Default-Group | | vrf_context_ref | global | | enable_autogw | True | | analytics_profile_ref | System-Analytics-Profile | | weight | 1 | | delay_fairness | False | | max_cps_per_client | 0 | | limit_doser | False | | type | VS_TYPE_NORMAL | | cloud_type | CLOUD_VCENTER | | use_bridge_ip_as_vip | False | | flow_dist | LOAD_AWARE | | ign_pool_net_reach | False | | ssl_sess_cache_avg_size | 1024 | | remove_listening_port_on_vs_down | False | | close_client_conn_on_config_update | False | | bulk_sync_kvcache | False | | tenant_ref | admin | | cloud_ref | Default-Cloud | | east_west_placement | False | | scaleout_ecmp | False | | active_standby_se_tag | ACTIVE_STANDBY_SE_1 | | flow_label_type | NO_LABEL | | dns_info[1] | | | fqdn | shared-vsvip.nmavi.local | | ttl | 30 | | type | DNS_RECORD_A | | num_records_in_response | 1 | | algorithm | DNS_RECORD_RESPONSE_CONSISTENT_HASH | | vip[1] | | | vip_id | 1 | | ip_address | 1.1.1.1 | | enabled | True | | discovered_networks[1] | | | network_ref | dvportgroup-1023-cloud-ac17f702-00ed-4c68-8e6c-2fa136706a5c | | subnet[1] | 10.52.90.0/24 | | auto_allocate_ip | False | | auto_allocate_floating_ip | False | | avi_allocated_vip | False | | avi_allocated_fip | False | | auto_allocate_ip_type | V4_ONLY | | vsvip_ref | shared-vsvip | | use_vip_as_snat | False | | traffic_enabled | True | +------------------------------------+-------------------------------------------------------------+
Configure the second virtual service as follows:
admin:10-52-1-115]: > configure virtualservice vs-2 [admin:10-52-1-115]: virtualservice> services New object being created [admin:10-52-1-115]: virtualservice:services> port 8080 [admin:10-52-1-115]: virtualservice:services> no enable_ssl +------------+-------+ | Field | Value | +------------+-------+ | port | 8080 | | enable_ssl | False | +------------+-------+ [admin:10-52-1-115]: virtualservice:services> port_range_end 8080 [admin:10-52-1-115]: virtualservice:services> save [admin:10-52-1-115]: virtualservice> vsvip_ref shared-vsvip [admin:10-52-1-115]: virtualservice> save +------------------------------------+-------------------------------------------------------------+ | Field | Value | +------------------------------------+-------------------------------------------------------------+ | uuid | virtualservice-3a5f7304-d3a5-4bca-be84-332982c7ab83 | | name | vs-2 | | enabled | True | | services[1] | | | port | 8080 | | enable_ssl | False | | port_range_end | 8080 | | application_profile_ref | System-HTTP | | network_profile_ref | System-TCP-Proxy | | se_group_ref | Default-Group | | vrf_context_ref | global | | enable_autogw | True | | analytics_profile_ref | System-Analytics-Profile | | weight | 1 | | delay_fairness | False | | max_cps_per_client | 0 | | limit_doser | False | | type | VS_TYPE_NORMAL | | cloud_type | CLOUD_VCENTER | | use_bridge_ip_as_vip | False | | flow_dist | LOAD_AWARE | | ign_pool_net_reach | False | | ssl_sess_cache_avg_size | 1024 | | remove_listening_port_on_vs_down | False | | close_client_conn_on_config_update | False | | bulk_sync_kvcache | False | | tenant_ref | admin | | cloud_ref | Default-Cloud | | east_west_placement | False | | scaleout_ecmp | False | | active_standby_se_tag | ACTIVE_STANDBY_SE_1 | | flow_label_type | NO_LABEL | | dns_info[1] | | | fqdn | shared-vsvip.nmavi.local | | ttl | 30 | | type | DNS_RECORD_A | | num_records_in_response | 1 | | algorithm | DNS_RECORD_RESPONSE_CONSISTENT_HASH | | vip[1] | | | vip_id | 1 | | ip_address | 1.1.1.1 | | enabled | True | | discovered_networks[1] | | | network_ref | dvportgroup-1023-cloud-ac17f702-00ed-4c68-8e6c-2fa136706a5c | | subnet[1] | 10.52.90.0/24 | | auto_allocate_ip | False | | auto_allocate_floating_ip | False | | avi_allocated_vip | False | | avi_allocated_fip | False | | auto_allocate_ip_type | V4_ONLY | | vsvip_ref | shared-vsvip | | use_vip_as_snat | False | | traffic_enabled | True | +------------------------------------+-------------------------------------------------------------+