How to Create Content Switching Policies using Global Server Load Balancing Location Database

How to Create Content Switching Policies using Global Server Load Balancing Location Database

book

Article ID: CTX121561

calendar_today

Updated On:

Description

This article describes how to use the Global Server Load balancing (GSLB) location database in Content Switching.

Background

GSLB location database can be used if you:

  • Have a long list of IP/subnet address ranges for which you need to create ContentSwitching policies.

  • Are using Source IP persistence and the same client is coming with different IP addresses (going through megaproxies).


Instructions

Complete the following procedure:

  1. Create a file under /var/netscaler/locdb directory.
    In NetScaler format, the file would look like the following:
    root@NS_2# more aol.db

    NSGEO1.0
    Start
    64.12.96.1, 64.12.127.254, aol
    10.1.1.1, 10.1.1.254, yahoo
    - - - - - - ctxs
    - - - - - - - xyz
    
  2. Enable GSLB  feature:
    NS_2> en feature gslb

  3. Load the file using the following command:
    NS_2> add locationfile aol.db
    NS_2> sh locationparameter

    Static Proximity
    ----------------
    Flushing: Idle; Loading: Idle;
    Context: geographic
    Qualifier 1 label: Continent
    Qualifier 2 label: Country
    Qualifier 3 label: Region
    Qualifier 4 label: City
    Qualifier 5 label: ISP
    Qualifier 6 label: Organization
    Location file (format: netscaler):
     aol.db
    Current static entries: 4  Current custom entries: 0
     Done
  4. To check whether an IP address is part of the file or not, from a shell prompt run:
    #nsmap –t –d

    Enter IP address to to test (dot notation) or q to exit: 10.1.1.2 -> Enter an IP addr here and hit return
    ============ Result for ip 10.1.1.2 ==============
    Found in the range from 10.1.1.1 to 10.1.1.254
     Qualifiers:
            yahoo.*.*.*.*.*
    Enter IP address to to test (dot notation) or q to exit:
    

    Note: Whenever you change entries in the file, you must reload it using the same add locationfile command and verify using sh locationparameter

  5. Bind over to Content Switching:
    add cs policy yahoo –rule  "CLIENT.IP.SRC.MATCHES_LOCATION(\"yahoo.*.*.*.*.*\")"
    add cs policy aol -rule "CLIENT.IP.SRC.MATCHES_LOCATION(\"aol.*.*.*.*.*\")"

  6. Use the policies in the Content Switching vServer and bind them to respective load balancing vServers with different priorities:
    bind cs vs testcs -policyName yahoo vyahoo -priority 3
    bind cs vs testcs -policyName aol vaol -priority 4

    With this, when a client request comes within the range 64.12.96.1- 64.12.127.254, a request goes to vaol (which is the aol vServer).
    If the client comes with IP address within the range 10.1.1.1 - 10.1.1.254, a request goes to the Yahoo vServer.

Issue/Introduction

This article describes how to use the Global Server Load balancing (GSLB) location database in Content Switching.

Additional Information

Citrix Documentation - Global Server Load Balancing