Forum Discussion
GDNS GTM DNS iRule Response Round Robin A Records for SVIP Databases
GTM/LTM version 11.3.0 HF 10.
Does anyone have an GTM DNS iRule that can be used to return three A records? I need a way to load balance databases between datacenters without changing their existing SVIP IP addresses. The LTMs have no connections (VLANs, self IPs) to the databases. We don't want to pass this traffic through our LTMs. Here is what I have tried to get working: I have not been able to get this to return three IP addresses: when DNS_REQUEST { Log query details log local0. "[DNS::question name]: [DNS::question name],\ [DNS::question class]: [DNS::question class], [DNS::question type]: [DNS::question type]"
if { [IP::addr [IP::remote_addr] equals x.x.x.x/x] } { host 10.x.x.x } else { host 10.x.x.x 10.x.x.x 10.x.x.x } }
I found this on this site but have not been able to get the DNS::answer insert to work:
Send one or more IP addresses for a response to an A query Use on an LTM virtual server with a DNS profile enabledwhen DNS_REQUEST { Log query details log local0. "[DNS::question name]: [DNS::question name],\ [DNS::question class]: [DNS::question class], [DNS::question type]: [DNS::question type]"
Generate an answer with two A records
DNS::answer insert "[DNS::question name]. 111 [DNS::question class] [DNS::question type] 10.x.x.x"
DNS::answer insert "[DNS::question name]. 111 [DNS::question class] [DNS::question type] 10.x.x.x"
Stop further processing of the query after this iRule and send the answer to the client
DNS::return
}
Any help would be greatly appreciated.
- scottn4milesto1
Nimbostratus
Give this a try;
when DNS_REQUEST { if { [IP::addr [IP::remote_addr] equals x.x.x.x/x] } { host 10.x.x.x } else { Generate an answer with three A records DNS::answer insert "[DNS::question name]. 111 [DNS::question class] [DNS::question type] 1.1.1.1" DNS::answer insert "[DNS::question name]. 111 [DNS::question class] [DNS::question type] 1.1.1.2" DNS::answer insert "[DNS::question name]. 111 [DNS::question class] [DNS::question type] 1.1.1.3" } DNS::return }
- ITGem
Altocumulus
Thanks Scott.
I get errors: line 5: [undefined procedure: DNS::answer] [DNS::answer insert "[DNS::question name]. 111 [DNS::question class] [DNS::question type] 1.1.1.1"] line 9: [undefined procedure: DNS::return] [DNS::return]
I know I need to change the IP address but what procedure is it referring to?
Thanks
- scottn4milesto1
Nimbostratus
If you do not have LTM licensed on the unit, you would be best configuring this with 'topology' LB.
Create two pool:
1) with the single IP
2) with the three IPs
Then use Topology to send traffic to pool one if the subnet matches, 0.0.0.0/0 send to pool 2.
- ITGem
Altocumulus
I like......but that means I would have to create VIPs on the LTM for the pools? That's a lot of VIPs since we have approximately 40 databases. ???? I mean I will do it if I have to but Have you ever had success modifying zone runner? I was able to create the record in zonerunner but zonerunner sometimes stops working when I query the record because of a bug limiting the FQDN to less than 25 characters. Again, any help is much appreciated.
- ITGem
Altocumulus
Here is the zonerunner record. IPs and names have been changed of course.
[jdoeitexp@computer ~]$ dig gtmtest01.globalqa.testltm.testgtm.com
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-25.P1.el5_11.2 <<>> gtmtest01.globalqa.testltm.testgtm.com ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26177 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION: ;gtmtest01.globalqa.testltm.testgtm.com. IN A
;; ANSWER SECTION: gtmtest01.globalqa.testltm.testgtm.com. 0 IN A 10.x.x.x gtmtest01.globalqa.testltm.testgtm.com. 0 IN A 10.x.x.x gtmtest01.globalqa.testltm.testgtm.com. 0 IN A 10.x.x.x
;; Query time: 3 msec ;; SERVER: 172.x.x.x53(172.x.x.x) ;; WHEN: Mon Dec 4 19:41:23 2017 ;; MSG SIZE rcvd: 102
- scottn4milesto1
Nimbostratus
You could create the servers/virtual servers on the GTM as generic hosts if they are not currently behind an LTM.
- ITGem
Altocumulus
Hello Scott.
I believe I need an LTM license to do this. Under local traffic I don't have the virtual servers menu. I only see the option to add LTM VIPs as pool members in my GTM. Please clarify.
- scottn4milesto1
Nimbostratus
The virtual server is built under the server in the GTM configuration. Please consult this document: https://support.f5.com/kb/en-us/products/big-ip_gtm/manuals/product/gtm-implementations-11-6-0.pdf
look under 'Defining a server"
- ITGem
Altocumulus
Hello Scott.
Regarding my previous comment to you above (see below), please clarify that I need an LTM license to enable this procedure in the GTM.
I get errors: line 5: [undefined procedure: DNS::answer] [DNS::answer insert "[DNS::question name]. 111 [DNS::question class] [DNS::question type] 1.1.1.1"] line 9: [undefined procedure: DNS::return] [DNS::return]
Also, do you know of any documentation you can point me to?
Thanks very much.
BTW. You have been very helpful and I have several options to consider.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com