cancel
Showing results for 
Search instead for 
Did you mean: 

Using an iRule to add source address affinity persistence.

DanS
Nimbostratus
Nimbostratus

Hello, i'm trying to figure out if there is a way to add a persistence profile (60 minute source address affinity) only to the pool members in the below irule. Basically we're doing hostname mapping via irule and only need a 60 minute persistence profile on the 3xxx pools. Any help would me much appreciated. Thanks!

 

when HTTP_REQUEST {

      if {[string tolower [HTTP::host]] equals "example.100.f5.com"} {

        node 10.10.10.77:44351

    }

      elseif {[string tolower [HTTP::host]] equals "example.200.f5.com"} {

        node 10.10.10.77:44358

    }

      elseif {[string tolower [HTTP::host]] equals "example.300.f5.com"} {

        node 10.10.10.77:44359

    }

      elseif {[string tolower [HTTP::host]] equals "example.400.f5.com"} {

          pool Treas_CRM-UAT_3259_Pool <-- need 60 minute source address affinity profile

    }

  elseif {[string tolower [HTTP::host]] equals "example.500.f5.com"} {

          pool Treas_ECC-UAT_3251_Pool <-- need 60 minute source address affinity profile

    }

      elseif {[string tolower [HTTP::host]] equals "example.600.f5.com"} {

          pool Treas_BW-UAT_3258_Pool <-- need 60 minute source address affinity profile

    }

      else { discard }

}

 

3 REPLIES 3

iaine
MVP
MVP

Hi

 

You can use the persist command to enable this - https://clouddocs.f5.com/api/irules/persist.html

DanS
Nimbostratus
Nimbostratus

So something like this? Please see below. thanks!

 

when HTTP_REQUEST {

      if {[string tolower [HTTP::host]] equals "example.100.f5.com"} {

        node 10.10.10.77:44351

    }

      elseif {[string tolower [HTTP::host]] equals "example.200.f5.com"} {

        node 10.10.10.77:44358

    }

      elseif {[string tolower [HTTP::host]] equals "example.300.f5.com"} {

        node 10.10.10.77:44359

    }

      elseif {[string tolower [HTTP::host]] equals "example.400.f5.com"} {

          pool Treas_CRM-UAT_3259_Pool <-- need 60 minute source address affinity profile

persist source_addr 255.255.255.255 3600

    }

  elseif {[string tolower [HTTP::host]] equals "example.500.f5.com"} {

          pool Treas_ECC-UAT_3251_Pool <-- need 60 minute source address affinity profile

persist source_addr 255.255.255.255 3600

    }

      elseif {[string tolower [HTTP::host]] equals "example.600.f5.com"} {

          pool Treas_BW-UAT_3258_Pool <-- need 60 minute source address affinity profile

persist source_addr 255.255.255.255 3600

    }

      else { discard }

}

 

iaine
MVP
MVP

Looks good to me