cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.

Forward DNS query to the specific node/pool based on query string - iRule

TechLearner
Nimbostratus
Nimbostratus

Hello Everyone,

 

I have a scenario where the DNS query need to send to the specific node/pool based on a query string.

Example, when user trying to resolve xyz-internal.example.com, the request should be send to the certain node/pool.

 

Is there any way that, iRule can match the specific string (internal) and based on that forward the request or it can be achieved in any other way?

I have tried on LTM in the LAB but seems like not working.

 

when DNS_REQUEST {   if {[DNS::question name] matches "internal"} {     node "10.10.10.10"   } else {     node "23.81.50.150"   } }

 

7 REPLIES 7

Yoann_Le_Corvi1
Cumulonimbus
Cumulonimbus

Hi,

 

Try :

 

when DNS_REQUEST { if {[DNS::question name] matches "internal"} { host "10.10.10.10" } else { host "23.81.50.150" } }

 

Hi Yoann,

 

I've tried but the below error occurred.

error: [undefined procedure: host][host "10.10.10.10"]

 

Yoann_Le_Corvi1
Cumulonimbus
Cumulonimbus

Hi

 

Don't you have GTM enabled on the system ? Are you using GTP Irule ?

 

Yoann

Hi,

 

No. I'm tried it on LTM.

TechLearner
Nimbostratus
Nimbostratus

Is there any way to achieve that goal on LTM?

Yoann_Le_Corvi1
Cumulonimbus
Cumulonimbus

Hi

 

Yes, if you have the DNS "Add-On" License, you cas use DNS::answer.

 

https://clouddocs.f5.com/api/irules/DNS__answer.html

 

Hope this does the trick for you.

 

Yoann

TechLearner
Nimbostratus
Nimbostratus

Thank you for your suggestion.

Currently I don't have it. Once its arranged, I'll test it.