CodeShare
Have some code. Share some code.
cancel
Showing results for 
Search instead for 
Did you mean: 
Deb_Allen_18
Historic F5 Account

Problem this snippet solves:

Distributes traffic to different pools based on LOGIN-IP address in LDAP request data.

First define the classes (Data Group Lists) as type "Address", adding the appropriate addresses to each.

Then apply the iRule to the virtual server, and it will distribute the traffic to each pool depending on the LOGIN-IP value.

Code :

# Data Group Lists

class AddressGroupA {
  "network 10.16.13.0/26"
  "host 10.10.10.1"
}

class AddressGroupB{
  "network 10.16.13.64/26"
  "host 10.10.10.2"
}

# iRule Source

when RULE_INIT {
  set ::defaultPool myPool
}
when CLIENT_ACCEPTED {
  TCP::collect
}
when CLIENT_DATA {
  set LoginIP [findstr [TCP::payload] LOGIN-IP 9 "MSISDN"]
  if {$LoginIP != ""}{
    if { [matchclass $LoginIP equals $::AddressGroupA]}{
      pool PoolA
    } elseif { [matchclass $LoginIP equals $::AddressGroupB]}{
      pool PoolA
    }
  } else {
    pool $::defaultPool
  }
  TCP::release
}
Version history
Last update:
‎18-Mar-2015 12:09
Updated by:
Contributors