For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

cmp19's avatar
cmp19
Icon for Nimbostratus rankNimbostratus
Feb 04, 2021
Solved

iRule Source IP to prioritized list of pool members

Hi!

Trying to create an iRule that matches a clients source IP and sends it to a specific pool member. If the pool member is down or offline, send it to a different member in the same pool. So far the source client is sticking to the first pool member in my statement, but when I turn that pool member off, connections are failing to pool member #2. What have I missed? Thanks for checking it out!

**Note %12 is my route domain this traffic lives in

when CLIENT_ACCEPTED {
 if { [IP::addr [IP::client_addr] equals a.a.a.a%12] } {
   pool test_pool member 2.2.2.2%12 8443
 } else {
   pool test_pool member 3.3.3.3%12 8443
 }
}
  • Basically, you are forcing the load balancing to member 1 whatever its status is. You need to either check its status before selecting it, or to use LB_FAILED event after selection to reselect another pool member.

        when CLIENT_ACCEPTED {
         if { [IP::addr [IP::client_addr] equals a.a.a.a%12] } {
          if { [LB::status pool test_pool member 2.2.2.2%12 8443] eq "up" } {
           pool test_pool member 2.2.2.2%12 8443
          } else {
           pool test_pool member 3.3.3.3%12 8443
          }
         }
        }

2 Replies

  • Basically, you are forcing the load balancing to member 1 whatever its status is. You need to either check its status before selecting it, or to use LB_FAILED event after selection to reselect another pool member.

        when CLIENT_ACCEPTED {
         if { [IP::addr [IP::client_addr] equals a.a.a.a%12] } {
          if { [LB::status pool test_pool member 2.2.2.2%12 8443] eq "up" } {
           pool test_pool member 2.2.2.2%12 8443
          } else {
           pool test_pool member 3.3.3.3%12 8443
          }
         }
        }
    • cmp19's avatar
      cmp19
      Icon for Nimbostratus rankNimbostratus

      This is exactly what I was missing. Thanks for such a quick response Amine!!