DNS::rr

Description

This iRules command creates a new resource record object with specified attributes or as a complete string.
Note: This command requires the DNS Profile, which is only enabled as part of GTM or the DNS Services add-on.

Syntax

DNS::rr <<name> <type> <class> <ttl> <rdata...> | <string>>

‘’’DNS::rr <<name> <type> <class> <ttl> <rdata…> | <string>>

  • Creates a new resource record object with specified attributes or as a complete string
    • name FQDN, e.g. devcentral.f5.com
    • type (A, NS, MD, MF, CNAME, SOA, MB, MG, MR, NULL, WKS, PTR, HINFO, MINFO, MX, TXT, RP, AFSDB, X25, ISDN, RT, NSAP, NSAP-PTR, SIG, KEY, PX, GPOS, AAAA, LOC, NXT, EID, NIMLOC, SRV, ATMA, NAPTR, KX, CERT, A6, DNAME, SINK, OPT, APL, DS, SSHFP, IPSECKEY, RRSIG, NSEC, DNSKEY, DHCID, NSEC3, NSEC3PARAM, HIP, SPF, TKEY, TSIG, IXFR, AXFR, MAILB, MAILA, ANY, ZXFR, or DLV)
    • class (IN, CH, HS)
    • rdata (dependent on type of RR, e.g. type “A”, rdata wil be “X.X.X.X”.

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
}

When an MX request is sent on test.intra domain, send a specific list of MX records, with additional resource records.
when DNS_REQUEST {
    if { ([string tolower [DNS::question type]] eq "mx")  &&  ([string tolower [DNS::question name]] eq "test.intra")} {
    DNS::answer clear
    set new_rr_1 [DNS::rr "mx.test.intra 100 IN MX 100 mx1.test.intra"]
    set new_rr_2 [DNS::rr "mx.test.intra" MX IN 600 "150 10.1.1.1"]
    set new_rr_1a [DNS::rr "mx1.test.intra" A IN 300 "10.10.10.10"]
    set new_rr_2a [DNS::rr "mx2.test.intra" A IN 50 "10.10.10.11"]
    DNS::answer insert $new_rr_1
    DNS::additional insert $new_rr_1a
    DNS::answer insert $new_rr_2
    DNS::additional insert $new_rr_2a
    DNS::header aa 1
    DNS::return
}
}

where you will see:

{{dig @10.100.30.133 -t MX test.intra

; <<>> DiG 9.6-ESV-R4-P3 <<>> @10.100.30.133 -t MX test.intra
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39264
;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 2
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;test.intra.            IN  MX

;; ANSWER SECTION:
mx.test.intra.      100 IN  MX  100 mx1.test.intra.
mx.test.intra.      600 IN  MX  150 10.1.1.1.

;; ADDITIONAL SECTION:
mx1.test.intra.     300 IN  A   10.10.10.10
mx2.test.intra.     50  IN  A   10.10.10.11

;; Query time: 7 msec
;; SERVER: 10.100.30.133#53(10.100.30.133)
;; WHEN: Wed Nov 27 17:26:33 2013
;; MSG SIZE  rcvd: 111
}}