Wiki: iRules API


When using an iRule with BIG-IP for DNS Services (called GTM before 12.0), the rule can be attached to two types of objects: 1. a WideIP; and 2. a DNS listener. Some commands can be used for only one of the two types of objects, while others can be used in both places. Moreover, some events only fire for one of the two objects, while others fire for rules associated with both. Since a DNS listener is handled by the Local Traffic component of BIG-IP, they are listed below as "LTM" commands and events. Be aware, however, that these rules can be used even if LTM is not provisioned on the system. Naturally, the "GTM" commands - which are associated with WideIP objects - can only be employed if GTM/DNS-Services is provisioned, because without that, a WideIP is not available.

Note: These commands work in a heavily rate-limited capacity via DNS-Lite in versions 11.4 through 12.1. If you use these features without a DNS Services license today, according to the end of life announcement in Solution 3503468, they will no longer be available when you reactivate your license effective Sep 1, 2016, so plan accordingly.

Command List for GTM & LTM

  • DNS::class - gets or sets the resource record class field
  • DNS::disable - sets the service state to disabled for the current dns packet.
  • DNS::edns0 - gets (v11.0+) and sets (v11.1+) the values of the edns0 pseudo-RR
  • DNS::enable - sets the service state to enabled for the current dns packet.
  • DNS::header - gets (v11.0+) or sets (v11.1+) simple bits or byte fields.
  • DNS::last_act - sets the action to perform if no DNS service handles this packet
  • DNS::len - returns the dns packet message length.
  • DNS::name - gets or sets the resource record name field
  • DNS::origin - returns the originator of the DNS message
  • DNS::ptype - returns the type of the DNS packet.
  • DNS::query - returns or constructs and sends a query to the DNS-Express database for a name and type
  • DNS::question - gets (v11.0+) or sets (v11.1+) the question field value
  • DNS::rdata - gets or sets the resource record rdata field
  • DNS::rr - creates a new resource record object with specified attributes or as a complete string.
  • DNS::tsig - manipulates the current DNS message and its TSIG resource record.
  • whereis - Returns geographical information on an IP address.

Command List for GTM Only

  • DNS::rrname - Returns the name requested by the client.
  • DNS::rrtype - Returns the resource record type requested by the client.

Command List for LTM Only

  • DNS::additional - returns, inserts, removes, or clears RRs from the additional section.
  • DNS::answer - returns, inserts, removes, or clears all RRs from the answer section.
  • DNS::authority - returns, inserts, removes, or clears RRs from the authority section.
  • DNS::drop - Drops the current DNS packet after the execution of the event.
  • DNS::is_wideip - returns status (true/false) if a string is a configured wide IP.
  • DNS::return - skips all further processing after TCL execution and sends the dns packet in the opposite direction.
  • DNS::scrape - allows users to walk over a DNS message and parse out information from the packet based on user supplied arguments
  • DNS::ttl - gets or sets the resource record ttl field
  • DNS::type - gets or sets the resource record type field

Event List for GTM & LTM

  • DNS_REQUEST - Triggered when the system receives a DNS request.

Event List for GTM Only

Event List for LTM Only

  • DNS_RESPONSE - Triggered when the system responds to a DNS request.