ADC

Set location qualifiers

The database used to implement static proximity has the location of the GSLB sites. Each location has an IP address range and up to six qualifiers for that range. The qualifiers are literal strings and are compared in a prescribed order at run time. Every location must have at least one qualifier. The qualifier labels define the meaning of the qualifiers (context), which are user defined. Citrix ADC has two built-in contexts:

Geographic context, which has the following qualifier labels:

  • Qualifier 1 – “Continent”
  • Qualifier 2 – “Country”
  • Qualifier 3 – “State”
  • Qualifier 4 – “City”
  • Qualifier 5 – “ISP”
  • Qualifier 6 – “Organization”

Custom entries, which have the following qualifier labels:

  • Qualifier 1 – “Qualifier 1”
  • Qualifier 2 – “Qualifier 2”
  • Qualifier 3 – “Qualifier 3”
  • Qualifier 4 – “Qualifier 4”
  • Qualifier 5 – “Qualifier 5”
  • Qualifier 6 – “Qualifier 6”

If the geographic context is set with no Continent qualifier, Continent is derived from Country. Even the built-in qualifier labels are based on the context, and the labels can be changed. These qualifier labels specify the locations mapped with the IP addresses used to make static proximity decisions.

To perform a static proximity-based decision, the Citrix ADC appliance compares the location attributes (qualifiers) derived from the IP address of the local DNS server resolver with the location attributes of the participating sites. If only one site matches, the appliance returns the IP address of that site. If there are multiple matches, the site selected is the result of a round robin on the matching GSLB sites. If there is no match, the site selected is a result of a round robin on all configured sites. A site that does not have any qualifiers is considered a match.

The GEO rules for location-based policy expression allow you to check wildcard matches. This feature checks whether wildcard qualifiers match any other qualifier including non-wildcard or not. The wildcard match is done by using the matchWildcardtoany attribute that is added to the set locationParameter command.

The matchWildcardtoany attribute can be set to the following values:

  • Yes: Wildcard qualifiers match any other qualifiers.
  • No: Wildcard qualifiers do not match non-wildcard qualifiers but match other wildcard qualifiers. The default option is No.
  • Expression: Wildcard qualifiers in an expression match any qualifier in an LDNS location but wildcard qualifiers in the LDNS location do not match non-wildcard qualifiers in an expression.

Example:

add dns policy policy1 "CLIENT.IP.SRC.MATCHES_LOCATION(\"Continent.country *.*.*.* \“)” <action>
<!--NeedCopy-->

To set the location parameters by using the CLI

At the command prompt, type:

set locationparameter -context <context> -q1label <string> [-q2label <string>] [-q3label <string>] [-q4label <string>] [-q5label <string>] [-q6label <string>] -matchWildcardtoany [Yes | No | Expression]
<!--NeedCopy-->

Example:

set locationparameter -context custom -q1label asia -matchWildcardtoany Yes
<!--NeedCopy-->

To set the location parameters by using the GUI

  1. Navigate to Traffic Management > GSLB > Database and Entries.
  2. Under Settings, click Change Location Parameters.
  3. In the Configure Location Parameters page, set the location parameters.

Configuration example (using CLI)

Consider the following network setup:

  • GSLB virtual server name: gv1
  • GSLB virtual server IP address: 1.1.1.2
  • GSLB Service: gsvc1 bound to gv1
  • Location DB file name: sample.csv
  • Geolocation qualifiers: Qualifiers 1 and 2 are configured. Rest is set to match the wildcard.
    • Qualifier 1–Asia
    • Qualifier 2–IR
    • Qualifier 3-*
    • Qualifier 4-*
    • Qualifier 5-*
    • Qualifier 6-*
  • DNS Policy-The policy, pol1, is set to drop the packets in if there is a match.

Set the location parameter and configure the DNS policy as follows:

set locationParameter -q2label Country_Code -q3label Subdivision_1_Name -q4label Subdivision_2_Name -q5label City

add locationFile "/var/netscaler/inbuilt_db/sample.csv"

add gslb vserver gv1 HTTP -backupLBMethod ROUNDROBIN -tolerance 0

add dns policy pol1 "CLIENT.IP.SRC.MATCHES_LOCATION(\"Asia.IR.*.*.*.*\")||CLIENT.IP.SRC.MATCHES_LOCATION(\"Asia.SY.*.*.*.*\")||CLIENT.IP.SRC.MATCHES_LOCATION(\"Asia.SD.*.*.*.*\")||CLIENT.IP.SRC.MATCHES_LOCATION(\"Asia.KP.*.*.*.*\")||CLIENT.IP.SRC.MATCHES_LOCATION(\"North America.CU.*.*.*.*\")||CLIENT.IP.SRC.MATCHES_LOCATION(\"Europe.UA.Crimea.*.*.*.*\")" dns_default_act_Drop

bind dns global pol1 1 -gotoPriorityExpression 65535 -type REQ_DEFAULT

add gslb service gsvc1 1.1.1.2 HTTP 80 -publicIP 1.1.1.2 -publicPort 80 -maxClient 0 -healthMonitor NO -siteName s1 -cltTimeout 180 -svrTimeout 360 -downStateFlush ENABLED

bind gslb vserver gv1 -serviceName gsvc1

bind gslb vserver gv1 -domainName www.gslbnew.com -TTL 5
<!--NeedCopy-->

Add the following client entries in the location DB file. In this example, the location DB file name is sample.csv:

10.106.24.170,10.106.24.190,,,,,,,8.0000,47.0000

10.102.82.170,10.102.82.190,Asia,,,,,,-73.9924,40.7553

10.106.24.140,10.106.24.150,,IR,,,,,51.4231,35.6961
<!--NeedCopy-->

According to the preceding configuration, the clients between 10.106.24.170 and 10.106.24.190 do not have any wildcard qualifiers defined. The clients between 10.106.24.140 and 10.106.24.150, have qualifier 2 as IR.

Set the match wildcard qualifier to NO:

set locationparameter -matchWildcardtoany no
<!--NeedCopy-->

When the match wildcard qualifier is set to NO, the wildcard qualifiers match only the defined wildcard qualifiers. It does not match any other non-wildcard qualifier.

  • The DNS queries coming 10.106.24.147 match the defined wildcard qualifier (qualifier 2 = IR). Therefore, the DNS policy comes into effect and drops the queries.

    When you run the dig @10.102.82.13 www.gslbnew.com command on the 10.106.24.147 client, the output shows that servers were not reachable.

     root@ns#  dig @10.102.82.13 www.gslbnew.com
    
     ; <<>> DiG 9.11.23 <<>> @10.102.82.13 www.gslbnew.com
     ; (1 server found)
     ;; global options: +cmd
     ;; connection timed out; no servers could be reached
     <!--NeedCopy-->
    
  • The DNS queries coming from 10.106.24.180, do not match the defined qualifiers. The DNS policy does not come into effect and the queries are processed.

    Run the dig @10.102.82.13 www.gslbnew.com command on the 10.106.24.180 client. The output shows the GSLB virtual server’s IP address.

     root@ns# dig @10.102.82.13 www.gslbnew.com
    
     ; <<>> DiG 9.11.23 <<>> @10.102.82.13 www.gslbnew.com
     ; (1 server found)
     ;; global options: +cmd
     ;; Got answer:
     ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64265
     ;; flags: qr aa rd ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
     ;; WARNING: recursion requested but not available
    
     ;; OPT PSEUDOSECTION:
     ; EDNS: version: 0, flags:; udp: 1280
     ;; QUESTION SECTION:
     ;www.gslbnew.com. IN    A
    
     ;; ANSWER SECTION:
     www.gslbnew.com.    5   IN  A   1.1.1.2
    
     ;; Query time: 12 msec
     ;; SERVER: 10.102.82.13#53(10.102.82.13)
     ;; WHEN: Tue Mar 29 22:46:40 UTC 2022
     ;; MSG SIZE  rcvd: 60
     <!--NeedCopy-->
    

Set the match wildcard qualifier to Yes:

set locationparameter -matchWildcardtoany yes
<!--NeedCopy-->

When the match wildcard qualifier is set to yes, the wildcard qualifiers match any wildcard qualifier (defined and non-wildcard qualifier).

  • The DNS queries coming 10.106.24.147 match the defined qualifier (qualifier 2 = IR). Therefore, the DNS policy comes into effect and drops the queries.

    Run the dig @10.102.82.13 www.gslbnew.com command on the 10.106.24.147 client. The output shows that servers were not reachable.

     root@ns#  dig @10.102.82.13 www.gslbnew.com
    
     ; <<>> DiG 9.11.23 <<>> @10.102.82.13 www.gslbnew.com
     ; (1 server found)
     ;; global options: +cmd
     ;; connection timed out; no servers could be reached
     <!--NeedCopy-->
    
  • The queries coming from 10.106.24.180, match the non-wildcard qualifiers. Therefore the DNS policy comes into effect and drops the queries.

    Run the dig @10.102.82.13 www.gslbnew.com command on the 10.106.24.180 client. The output shows that servers were not reachable.

     root@ns# dig @10.102.82.13 www.gslbnew.com
    
     ; <<>> DiG 9.11.23 <<>> @10.102.82.13 www.gslbnew.com
     ; (1 server found)
     ;; global options: +cmd
     ;; connection timed out; no servers could be reached
     <!--NeedCopy-->
    

Set the match wildcard qualifier to Expression:

set locationparameter -matchWildcardtoany expression
<!--NeedCopy-->

When the match wildcard qualifier is set to expression, the wildcard qualifiers match either the qualifier available in the DNS policy or the qualifiers available in the location DB file.

  • The DNS queries coming 10.106.24.147 match the defined wildcard qualifiers in the DNS policy. Therefore, the DNS policy comes into effect and drops the queries.

    Run the dig @10.102.82.13 www.gslbnew.com command on the 10.106.24.147 client. The output shows that servers were not reachable.

     root@ns#  dig @10.102.82.13 www.gslbnew.com
    
     ; <<>> DiG 9.11.23 <<>> @10.102.82.13 www.gslbnew.com
     ; (1 server found)
     ;; global options: +cmd
     ;; connection timed out; no servers could be reached
     <!--NeedCopy-->
    
  • The queries coming from 10.106.24.180 do not match the qualifiers in the DNS policy. Therefore, the DNS policy does not come into effect and the queries are processed.

    Run the dig @10.102.82.13 www.gslbnew.com command on the 10.106.24.180 client. The output shows the GSLB virtual server’s IP address.

     root@ns# dig @10.102.82.13 www.gslbnew.com
    
     ; <<>> DiG 9.11.23 <<>> @10.102.82.13 www.gslbnew.com
     ; (1 server found)
     ;; global options: +cmd
     ;; Got answer:
     ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64265
     ;; flags: qr aa rd ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
     ;; WARNING: recursion requested but not available
    
     ;; OPT PSEUDOSECTION:
     ; EDNS: version: 0, flags:; udp: 1280
     ;; QUESTION SECTION:
     ;www.gslbnew.com.  IN   A
    
     ;; ANSWER SECTION:
     www.gslbnew.com.    5   IN  A   1.1.1.2
    
     ;; Query time: 12 msec
     ;; SERVER: 10.102.82.13#53(10.102.82.13)
     ;; WHEN: Tue Mar 29 22:46:40 UTC 2022
     ;; MSG SIZE  rcvd: 60
     <!--NeedCopy-->
    
Set location qualifiers