Have some code. Share some code.
Showing results for 
Search instead for 
Did you mean: 
Community Manager
Community Manager

Problem this snippet solves:

GTM has the ability to persist client requests to a virtual (or real) server for a configurable duration. This persistence is set at the Wide IP level, and is a yes/no proposition. There is no configuration option to selectively set persistence. GTM hasn't yet implemented a persist command like the one that is available in LTM iRules either. But as usual, there is another way to solve the problem with F5 gear, courtesy of your friendly neighborhood F5 Support Team!

Utilizing iRules to inspect the source of the request, you can use the cname command to redirect selected queries from a persistence-enabled WideIP to a Wide IP defined on the GTM where persistence is not configured.

To configure this scenario, define two Wide IP's, one with persistence and one without. Apply the iRule below to the persistence enabled Wide IP. The iRule checks for known source addresses for which persistence is not required and sends a CNAME redirect to a Wide IP with no persistence.

How to use this snippet:

iRule Source: GTM Selective Persistence

rule "SelectivePersist-rule" { when DNS_REQUEST { if { [IP::addr [IP::client_addr] equals] \ or [IP::addr [IP::client_addr] equals] } { cname "" } } }

GTM doesn’t yet support class lists, but when it does, you’ll be able to create a class lookup instead of nested elseif’s for longer lists of addresses.

In the meantime, as an alternative, you could use regions and the matchregion command to avoid multiple IP::addr executions.

Code :

# Wide IP Definitions

# Wide IP with Persistence and iRule

wideip {
   name         ""
   persist      yes
   persist_ttl  1800
   pool_lbmode  rr
   pool         "myPool"
   rule         "SelectivePersist-rule"

# Wide IP with No Persistence

wideip {
   name         ""
   pool_lbmode  rr
   pool         "myPool"
Version history
Last update:
‎17-Mar-2015 14:34
Updated by: