Forum Discussion
Arnor_Arnason
May 23, 2011Altostratus
How to answer a DNS SRV request in a irule on GTM
Hi, I know how I could answer an A request directly with an host ip in an irule: when DNS_REQUEST {
if { [IP::addr [IP::client_addr]/24 equals "10.10.10.0] } {
use pool GTM_pool1
}...
Kai_Wilke
Jan 19, 2016MVP
Hi Aref,
you may try the syntax below to intercept and respond to a specific SRV DNS query. It will also set authority information and additional records for the resolved SRV records to speed up DNS resolution (if supported by the DNS client).
when DNS_REQUEST {
log local0. "\[DNS::question name\]: [DNS::question name], \[DNS::question class\]: [DNS::question class], \[DNS::question type\]: [DNS::question type]"
set ttl 300
if { [string tolower [DNS::question name]] starts_with "_ldap._tcp.dc._msdcs.domain.de" } then {
if { [DNS::question type] equals "SRV" } then {
SOA information
DNS::authority insert "domain.de. $ttl IN SOA server1.domain.de hostmaster.domain.de 1337 900 600 86400 3600"
SRV response
DNS::answer insert "[DNS::question name]. $ttl IN [DNS::question type] 1 0 389 server1.domain.de"
DNS::answer insert "[DNS::question name]. $ttl IN [DNS::question type] 1 0 389 server2.domain.de"
Additional records
DNS::additional insert "server1.domain.de. $ttl IN A 192.168.1.1"
DNS::additional insert "server2.domain.de. $ttl IN A 192.168.1.2"
DNS::return
}
}
}
Note: The syntax can be used for v11.1+ LTM deployments.
Cheers, Kai
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects