Forum Discussion

shashank_shetti's avatar
shashank_shetti
Icon for Nimbostratus rankNimbostratus
Feb 19, 2016

Virtual server setup for DNS resolution

I do have the following irule code

 

set dest [lindex [RESOLV::lookup @9.9.9.9 -a "somesite.com"] 0]

 

I do not want to hard code dns ip in the above code instead wanted to create virtual server to resolve dns as suggested in the following thread

 

https://devcentral.f5.com/questions/resolvlookup-hard-coded-dns-ip-address-how-to-avoid-hard-coding-in-irule

 

Here is something i wanted my code look like

 

https://devcentral.f5.com/wiki/iRules.resolv__lookup.ashx

 

Ex: set dest [lindex [RESOLV::lookup @$static::dns_vs -a "somesite.com"] 0]

 

Could you please provide details on what type of virtual server i should be creating and configuration details to make it work?

 

1 Reply

  • You would need two virtual servers, both would listen on port 53, but one would be UDP and the other TCP. You could use any virtual server type, and point them at a pool of actual DNS servers.

     

    In your example, all you've done is substitute the hard coded IP address of the DNS server with a static variable, which you would of course need to define in the RULE_INIT event. The creation of virtual servers is not necessary at that point - you would only need to do that if you wanted to abstract it one further level, so that you could add resiliency in the event that one DNS server was unavailable, for example.