Forum Discussion

Nikson_M's avatar
Nikson_M
Icon for Cirrus rankCirrus
May 15, 2020

GTM iRule for DNS query treatment.

Folks,

We have our GTM configured with many domains. All the configured domains are a part of our subdomain "test.com".

 

We want to configure any domain on the GTM, say "abc.test.com".

However this domain should not have any pools in it. This should do DNS queries based on some iRule.

 

What we need is if the client IP is 1.1.1.0/24 then the GTM should forward the query to a pool of dnsserver1.com and dnsserver2.com.

If the clients IP is 2.2.2.0/24 then the GTM should forward the query to a pool of dnsserver3.com and dnsserver4.com.

 

Any suggestion?

 

Thanks much for the help!!

 

2 Replies

  • If you look at the clouddocs page for DNS_REQUEST (https://clouddocs.f5.com/api/irules/DNS_REQUEST.html), there is example code for checking the source address of the query*. From there you can choose the pool to forward the resolution to.

     

    *Keep in mind that the source address of the query is seldom the actual client, but is usually the client's configured DNS server.

  • Look into EDNS support. You might have to do something like this.

     

    when DNS_REQUEST {

    if { [DNS::edns0 exists] } {

    log local0. [DNS::edns0 subnet address]"

    }

    }

     

    --Patrick