Forum Discussion

duBeN_123857's avatar
duBeN_123857
Icon for Nimbostratus rankNimbostratus
Jul 15, 2013

load balancing based on source IP

Hello,

 

I'd like to configure load balancing based on source IP address. I have 2 clients which will send requests to BigIP VIP and these request then will be load balanced to 2 servers. I want to configure it in the way that 1st client will be forwarded always to 1st server and 2nd client to 2nd server unless of course one of the servers will be down.

 

What I found is to do this via iRules :

 

when HTTP_REQUEST {

 

if { [IP::addr [IP::client_addr] equals 192.168.1.1] } {

 

pool My_Pool member 10.10.10.1 80

 

} else if { [IP::addr [IP::client_addr] equals 192.168.1.2] } {

 

pool My_pool member 10.10.10.2 80

 

}

 

}

 

I have no option to test it right now but I'm afraid what will happen if one of the servers will be down ? Will be the request forwarded to the remaining server ? Also maybe there is more elegant way how to achieve this. Please advise :)

 

Thank you

 

1 Reply

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    duBeN,

     

     

    Check out these two links:

     

     

    https://devcentral.f5.com/tech-tips/articles/irules-101-05-selecting-pools-pool-members-and-nodes.UeP5XaxbY-A

     

    https://devcentral.f5.com/wiki/iRules.LB__status.ashx

     

     

    Hope this helps.

     

     

    PS "else if" should be "elseif" but in your example then just use "else". If I'm right then if/elseif combo needs a final else.

     

     

    N