Forum Discussion

F5SJ_'s avatar
F5SJ_
Icon for Altocumulus rankAltocumulus
Aug 28, 2020

irule to redirect traffic to multiple pools

All,

 

We have one vip which is redirecting traffic to multiple pools via irule.

 

rule:

 

when CLIENT_ACCEPTED {

    if { [class match [IP::client_addr] equals xxxx] } {

        pool xxxx

    } elseif { [class match [IP::client_addr] equals zzzz] } {

        pool zzzz

    } elseif { [class match [IP::client_addr] equals yyyy] } {

        pool yyyy

    } else {

        #log local0. "Default pool (drop): [IP::client_addr]-->[LB::server]" 

        drop

    }

 

}

 

All pools have same pool member (IP) but ports are different. Now we need to add one more pool member not as a load balancing but it will receive traffic at a same time.

 

I have prepared one irule for that:

 

when CLIENT_ACCEPTED {

    if { [class match [IP::client_addr] equals test_1234] } {

         pool test

pool test2

    } else {

        #log local0. "Default pool (drop): [IP::client_addr]-->[LB::server]" 

        drop

    }

 

}

 

But I am not seeing traffic in both the pools. Could someone check the code and let me know the correct way to do this.

3 Replies

    • F5SJ_'s avatar
      F5SJ_
      Icon for Altocumulus rankAltocumulus

       : Thanks for the response, if I'll try to achieve the cloning in our case where we are redirecting traffic to pools via irule as we have more than one pool in VS will it possible vial below irule modifications:

       

      when CLIENT_ACCEPTED {

       if { [class match [IP::client_addr] equals real_pool] } {

          pool real_pool

      clone pool clone_pool

      } elseif { [class match [IP::client_addr] equals zzzz] } {

       

          pool zzzz

      clone pool clone_pool

        } elseif { [class match [IP::client_addr] equals yyyy] } {

       

          pool yyyy

      clone pool clone_pool

        } else {

       

          #log local0. "Default pool (drop): [IP::client_addr]-->[LB::server]" 

       

          drop

       

        }

       

       

       

      }

  • I have tried to improve the rule:

     

    when CLIENT_ACCEPTED {

        if { [class match [IP::client_addr] equals DG1] } {

            pool pool1

    clone clonepool1

        } elseif { [class match [IP::client_addr] equals DG2] } {

            pool pool2

    clone pool clonepool2

           }else {

            #log local0. "Default pool (drop): [IP::client_addr]-->[LB::server]" 

            drop

        }

     

    want to verify if the irule which I have created will clone the connections or not

     

    }