Applies To:

Show Versions Show Versions

Manual Chapter: iRules
Manual Chapter
Table of Contents   |   << Previous Chapter   |   Next Chapter >>

15 
As you work with Global Traffic Manager, you might find that you want to incorporate additional customizations beyond the available features associated with load balancing, monitors, or other aspects of your traffic management. For example, you might want to have the system respond to a name resolution request with a specific CNAME record, but only when the request is for a particular wide IP and originates from Europe. In Global Traffic Manager, these customizations are defined through iRules®. iRules are code snippets that are based on TCL 8.4. These snippets allow you a great deal of flexibility in managing your global network traffic.
If you are familiar with Local Traffic Manager, you might already be aware of and use iRules to manage your network traffic on a local level. The iRules in Global Traffic Manager share a similar syntax with their Local Traffic Manager counterparts, but support a different set of events and objects.
Due to the dynamic nature of iRules development, the following sections focus on providing an overview of iRule operations and describe the events and command specific to Global Traffic Manager. For additional information about how to write iRules, visit the F5 DevCentral web site: http://devcentral.f5.com. At this site, you can learn more about iRules development, as well as discuss iRules functionality with others.
An iRule is a script that you write if you want individual connections to target a pool other than the default pool defined for a virtual server. iRules allow you to more directly specify the pools to which you want traffic to be directed. Using iRules, you can send traffic not only to pools, but also to individual pool members or hosts.
The iRules you create can be simple or sophisticated, depending on your content-switching needs. Figure 15.1 shows an example of a simple iRule.
Figure 15.1 Example of an iRule
This iRule is triggered when a DNS request has been detected, causing Global Traffic Manager to send the packet to the pool my_pool, if the IP address of the local DNS making the request matches 10.10.10.10.
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 set of extensions that Global Traffic Manager provides to help you further increase load balancing efficiency.
In a basic system configuration where no iRule exists, Global Traffic Manager directs incoming traffic to the default pool assigned to the wide IP that receives that traffic based on the assigned load balancing modes. However, you might want Global Traffic Manager to direct certain kinds of connections to other destinations. The way to do this is to write an iRule that directs traffic to that other destinations contingent on a certain type of event occurring. Otherwise, traffic continues to go to the default pool assigned to the wide IP.
iRules are evaluated whenever an event occurs that you have specified in the iRule. For example, if an iRule includes the event declaration DNS_REQUEST, then the iRule is triggered whenever Global Traffic Manager receives a name resolution request. Global Traffic Manager then follows the directions in the remainder of the iRule to determine the destination of the packet.
When you assign multiple iRules as resources for a wide IP, it is important to consider the order in which you list them on the wide IP. This is because Global Traffic Manager processes duplicate iRule events in the order that the applicable iRules are listed. An iRule event can therefore terminate the triggering of events, thus preventing Global Traffic Manager from triggering subsequent events.
The iRules feature includes several types of event declarations that you can make in an iRule. Specifying an event declaration determines when Global Traffic Manager evaluates the iRule. The following sections list and describe these event types. Also described is the concept of iRule context and the use of the when keyword.
You make an event declaration in an iRule by using the when keyword, followed by the event name. For example:
Table of Contents   |   << Previous Chapter   |   Next Chapter >>

Was this resource helpful in solving your issue?




NOTE: Please do not provide personal information.



Incorrect answer. Please try again: Please enter the words to the right: Please enter the numbers you hear:

Additional Comments (optional)