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.

BIG-IP SRV record response

Tski81
Nimbostratus
Nimbostratus

Hello, was looking for some help on this. I am wanting to create an iRule that responds with individually weighted FQDN's when a specific SRV record is requested. Since I am attaching to a SRV WIP, was wondering how this code actually shapes up. Thanks all!!

 

I am doing this on big IP and keep getting undefined procedures

when DNS_REQUEST {      if { [DNS::question type] equals "SRV" } then {          SRV response       DNS::answer insert "[DNS::question name]. $ttl IN [DNS::question type] 10 50 8443 server1.domain.com"       DNS::answer insert "[DNS::question name]. $ttl IN [DNS::question type] 10 50 8443 server2.domain.com"       DNS::answer insert "[DNS::question name]. $ttl IN [DNS::question type] 20 50 8443 server3.domain.com"       DNS::answer insert "[DNS::question name]. $ttl IN [DNS::question type] 20 50 8443 server4.domain.com"               DNS::return     } }
1 REPLY 1

Pedro_Haoa
F5 Employee
F5 Employee

Hi,

 

Maybe you can try the following example:

 

when DNS_REQUEST { if { [string tolower [DNS::question name]] starts_with "_service._tcp.dc._msdcs.domain.com" } then { if { [DNS::question type] equals "SRV" } then { # Set your TTL set ttl 300 # 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 SOA information DNS::authority insert "domain.com. $ttl IN SOA server1.domain.com hostmaster.domain.com 1337 900 600 86400 3600"   # Generate an answer with four SRV records DNS::answer insert "[DNS::question name]. $ttl IN [DNS::question type] 10 50 8443 server1.domain.com" DNS::answer insert "[DNS::question name]. $ttl IN [DNS::question type] 10 50 8443 server2.domain.com" DNS::answer insert "[DNS::question name]. $ttl IN [DNS::question type] 20 50 8443 server3.domain.com" DNS::answer insert "[DNS::question name]. $ttl IN [DNS::question type] 20 50 8443 server4.domain.com" # Generate additional records DNS::additional insert "server1.domain.com. $ttl IN A 192.168.1.1" DNS::additional insert "server2.domain.com. $ttl IN A 192.168.1.2" DNS::additional insert "server3.domain.com. $ttl IN A 192.168.1.3" DNS::additional insert "server4.domain.com. $ttl IN A 192.168.1.4" # Stop further processing of the query after this iRule and send the answer to the client DNS::return } } }

I hope it helps.