Forum Discussion

sandiksk_35282's avatar
sandiksk_35282
Icon for Altostratus rankAltostratus
Apr 21, 2018

irule to force traffic to a particular server.

I need some help as we are forcing some reverse proxy server traffic ( acting as source ) to go a specific pool member

 

Reverse Proxy Server 1 ------------------> Pool Member 1 Reverse Proxy Server 2 ------------------> Pool Member 2

 

Below irule is working as expected . but when pool member 1 is down we dont see the traffic from reverse proxy server1 failing over to pool member 2.

 

Please assist me on this.

 

when CLIENT_ACCEPTED { if { [IP::client_addr] == "10.20.1.111" } {

 

pool prod_443 member 10.9.41.25 } elseif { [IP::client_addr] == "10.20.1.142" }{ pool prod_443 member 10.19.41.24 } }

 

  • when CLIENT_ACCEPTED { 
      if { [IP::client_addr] == "10.20.1.111" } 
        { pool prod_443 member 10.9.41.25 } 
      elseif { [IP::client_addr] == "10.20.1.142" }
        { pool prod_443 member 10.19.41.24 } 
    }
    

    Your irule selects specific pool members for each client IP.

    There is no provision for a load-balancing decision if the selected member is unavailable.

    You need to check the status of the pool member with LB::status

    Something like the following, although I have not tested this ...
    when CLIENT_ACCEPTED { 
       get the default load-balancing pick
      set mypick [LB::select]
      if { (([IP::client_addr] == "10.20.1.111") && ([LB::status pool prod_443 member 10.9.41.25 443] eq "up"))  } 
        { pool prod_443 member 10.9.41.25 } 
      elseif { (([IP::client_addr] == "10.20.1.142") && ([LB::status pool prod_443 member 10.9.41.24 443] eq "up"))  }
        { pool prod_443 member 10.19.41.24 }
       the default pick is chosen 
      else { eval $mypick }
    }
    
  • If i dont use the statement else { eval $mypick } will the default pool will not be selected or do i need specify the default pool member.

     

  • Yes - if you do not hit one of the explicit load-balancing selections, then the default load-balancing pool selection will occur.

     

  • I am having issues with this irule . It is not work at all. Can you please assist me on this

     

    Rule [/Common/new_irule80] error: /Common/new_irule80:9: error: [undefined procedure: else][else { eval $mypick }]

     

    and the traffic not hitting the irule at all.

     

  • Try the following:

    The formatting of the if-elseif-else is important
    when CLIENT_ACCEPTED { 
       get the default load-balancing pick
      set mypick [LB::select]
      if { (([IP::client_addr] == "10.20.1.111") && ([LB::status pool prod_443 member 10.9.41.25 443] eq "up"))  } { 
          pool prod_443 member 10.9.41.25 
      } 
      elseif { (([IP::client_addr] == "10.20.1.142") && ([LB::status pool prod_443 member 10.9.41.24 443] eq "up"))  } { 
          pool prod_443 member 10.19.41.24 
      } else {
           the default pick is chosen
          eval $mypick 
      }
    }
    
  • Thankyou

     

    but wondering apart from irule is there any other specific logic i can use as we have total 5 webseal servers ( all the client requests are being reverse proxied). So webseal servers are the one which is hitting the vip. So for now we are forcing 2 webseals to access the pool members directly and the othere 3 webseals are using the LB method( round robin) so the traffic atleast is distributed equally across 2 pool members.

     

    Is there any better logic or method to setup the vip

     

  • I'm not sure I understand what you are trying to do.

     

    Why not use Round-Robin LB for all connections?

     

  • using round robin and src IP persistence , 1 pool member is taking max hits so we want to reduce the connection overhead

     

    so we cameup with the irule to limit 2 reverseproxy clients to access the pool members directly and the other 3 reverse proxy servers comes across round robin and src ip persistence.

     

    I was wondering if there is a better way to implement this.