What Is An iRule¶
Summary: An iRule is a script that you write if you want to make use
of some of the extended capabilities of the BIG-IP that are
unavailable via the CLI or GUI.
What is an iRule?¶
An iRule is a script that you write if you want to make use of some of
the extended capabilities of the BIG-IP that are unavailable via the
CLI or GUI. iRules allow you to more directly interact with the
traffic passing through the device. Using iRules, you can send traffic
not only to pools, but also to individual pool members, ports, or
URIs. And directing traffic to a desired pool is only the beginning.
You can parse the entire header and payload of the data as it is being
passed through the BIG-IP and, at wire speed, execute an entire script
of commands on that traffic. The commands at your disposal range from
logging to redirecting traffic, from modifying the URI or port to
actually rewriting the payload itself.
The iRules you create can be simple or sophisticated, depending on
your content-switching needs. The following shows an example of a
simple iRule.
when CLIENT_ACCEPTED {
if { [IP::addr [IP::client_addr] equals 10.10.10.10] } {
pool my_pool
}
}
This iRule is triggered when a client-side connection has been
accepted, causing the LTM system to send the packet to the pool
my_pool, if the client’s address matches 10.10.10.10.
Using a feature called the Universal Inspection Engine (UIE), you
can write an iRule that searches either a header of a packet, or
actual packet content, and then directs the packet based on the result
of that search. iRules can also direct packets based on the result of
a client authentication attempt.
iRules can direct traffic not only to specific pools, but also to
individual pool members, including port numbers and URI paths, either
to implement persistence or to meet specific load balancing
requirements.
The syntax that you use to write iRules is based on the Tool Command
Language (Tcl) programming standard. Thus, you can use many of the
standard Tcl commands, plus a robust set of extensions that the LTM
system provides to help you further increase load balancing
efficiency.
For information about standard Tcl syntax, see the TCL
Reference
The BIG-IP API Reference documentation contains community-contributed content. F5 does not monitor or control community code contributions. We make no guarantees or warranties regarding the available code, and it may contain errors, defects, bugs, inaccuracies, or security vulnerabilities. Your access to and use of any code available in the BIG-IP API reference guides is solely at your own risk.