Destination Based Routing
Problem this snippet solves:
This iRule makes routing decisions based upon the destination address and whether that address is in on the the data groups called. This uses the matchclass method to try and match IP::localaddr to the members of various data groups. As an aside IP::localaddr is on a forwarding virtual server returns the value of the destination ip address.
Code :
# David A. Homoney, F5 Networks Consulting # July 2006 # Tested on 9.1.1 when CLIENT_ACCEPTED { if { [matchclass [IP::local_addr] equals $::Subnet1] } { pool FW1 } elseif { [matchclass [IP::local_addr] equals $::Subnet2] } { pool FW2 } elseif { [matchclass [IP::local_addr] equals $::Subnet3] } { pool FW3 } elseif { [matchclass [IP::local_addr] equals $::Subnet4] } { pool FW4 } elseif { [matchclass [IP::local_addr] equals $::Subnet5] } { pool FW5 } elseif { [matchclass [IP::local_addr] equals $::Subnet6] } { pool FW6 } elseif { [matchclass [IP::local_addr] equals $::Subnet7] } { pool FW7_SNAT } elseif { [matchclass [IP::local_addr] equals $::Subnet8] } { pool FW8 } else { pool FW9 } }
Tested this on version:
9.1Published Mar 17, 2015
Version 1.0CodeCentral_194
Cirrus
Joined May 05, 2019
CodeCentral_194
Cirrus
Joined May 05, 2019
- nomædEmployee
What is the actual difference between "equals" and the standard TCL's "eq" for comparing strings?