ltm rule command DNS answerΒΆ

iRule(1)		      BIG-IP TMSH Manual		      iRule(1)



DNS::answer
       Returns, inserts, removes, or clears all RRs from the answer section.

SYNOPSIS
       DNS::answer ('clear' | (('insert' | 'remove') RR_OBJECT))?

DESCRIPTION
       This iRules command returns, inserts, removes, or clears RRs from the
       answer section.

       Note: This command functions only in the context of LTM iRules and
       requires the DNS Profile, which is only enabled as part of GTM or the
       DNS Services add-on.

       Syntax

       DNS::answer [[insert|remove rr_obj] | clear]

	    * Returns, inserts, removes, or clears RRs from the answer section.
	      With no arguments, get tcl list of RR objs; with arg, insert/remove
	      RR tcl obj in the answer section or clear all RRs from the answer
	      section.

RETURN VALUE
VALID DURING
       DNS_REQUEST, DNS_RESPONSE

EXAMPLES
	# Change the ttl of all answer records and add a glue record
	when DNS_RESPONSE {
	    set rrs [DNS::answer]
	    foreach rr $rrs {
		DNS::ttl $rr 1234
	    }
	    set new_rr [DNS::rr "bigip3900-30.f5net.com. 88 IN A 1.2.3.4"]
	    DNS::additional insert $new_rr
	}

	# Send one or more IP addresses for a response to an A query
	# Use on an LTM virtual server with a DNS profile enabled
	when DNS_REQUEST {
	    # 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 two A records
	    DNS::answer insert "[DNS::question name]. 111 [DNS::question class] [DNS::question type] 1.1.1.1"
	    DNS::answer insert "[DNS::question name]. 111 [DNS::question class] [DNS::question type] 1.1.1.2"
	    # Stop further processing of the query after this iRule and send the answer to the client
	    DNS::return
	    return
	}

HINTS
SEE ALSO
CHANGE LOG
       @BIGIP-11.1.0 --First introduced the command.



BIG-IP				  2017-01-31			      iRule(1)