How to control IP address returned in a DNS query based on source IP address (local DNS IP address)

How to control IP address returned in a DNS query based on source IP address (local DNS IP address)

book

Article ID: CTX495236

calendar_today

Updated On:

Description

This article contains information about how to control IP address returned in a DNS query based on source IP address (local DNS IP address)
The IP addresses DNS returned must work in active/standby mode.
Also, you can use DNS policy expressions to monitor load balancing service status(associate to the IP addresses you want to return) .


Instructions

To control IP address returned in a DNS query based on source IP address (local DNS IP address)complete the following steps:

1.Run the following command to add two load balancing services 
> add service <Service_Name1><IP_Address1><Protocol><Port>
> add service <Service_Name2><IP_Address2><Protocol><Port>


2.Run the following command to add two DNS views:
> add dns view <View_Name1>
> add dns view <View_Name2>

3.Run the following command to add two DNS actions:
add dns action <Action_Name1> ViewName -viewName <View_Name1>
add dns action <Action_Name2> ViewName -viewName <View_Name1>

4.Run the following command to bind a Global Server Load Balancing service to the DNS view you created:
>  bind gslb service <Service_Name> –view <View_Name1> <IP_Address1>
>  bind gslb service <Service_Name> –view <View_Name2> <IP_Address2>

5.Run the following command to add two DNS policies:
> add dns policy <Policy_Name> “<Rule>” –viewName <View_Name>

In the following samples, the Policy_01 policy verifies if the client request is received from the subnet 172.18.22.77/32 or 172.18.23.77/32, and if the request is from these subnets and the DNS query contains xxx , and the service Service_Name1 state is UP, then the Internal DNS view is applied and the IP address configured for the view is returned to the client. 

add dns policy Policy_01 "(CLIENT.IP.SRC.IN_SUBNET(172.18.22.77/32)||CLIENT.IP.SRC.IN_SUBNET(172.18.23.77/32))&&SYS.SERVICE(\"Service_Name1\").STATE.EQ(UP)&&DNS.REQ.QUESTION.DOMAIN.CONTAINS(\"xxx\")" Action_01
add dns policy Policy_02 "(CLIENT.IP.SRC.IN_SUBNET(172.18.22.77/32)||CLIENT.IP.SRC.IN_SUBNET(172.18.23.77/32))&&SYS.SERVICE(\"Service_Name2\").STATE.EQ(UP)&&DNS.REQ.QUESTION.DOMAIN.CONTAINS(\"xxx\")" Action_02

6.Run the following command to bind the DNS policy globally
> bind dns policy <Policy_Name> -gotoPriorityExpression  <NEXT/END>  -type REQ_OVERRIDE

bind dns global Policy_01 100 -gotoPriorityExpression NEXT -type REQ_OVERRIDE
bind dns global Policy_02 110 -gotoPriorityExpression END -type REQ_OVERRIDE