Forum Discussion

sonu_kumar4's avatar
sonu_kumar4
Icon for Altostratus rankAltostratus
Jan 10, 2019

i-Rule redirect/load-balance request based upon source subnets.

Hello Guys,

 

I am looking for I-rule which could load-balance the requests to different-2 pools based upon the different-2 source subnets.

 

let's say I have three pool:-

 

Pool-A 10.10.10.10 10.10.10.20

 

Pool-B 10.10.20.10 10.10.20.20

 

Pool-C 10.10.30.10 10.10.30.20

 

Source Subnets:- Let's say I have three sites.

 

Site A:- 172.16.10.x 172.16.20.x

 

Site B:- 172.16.30.x 172.16.40.x

 

Site C:- 172.16.50.x 172.16.60.x

 

Now I need that if there is any request from site A needs to forward to pool-A , Site B move to pool-B and site C move to pool-C and else all move to pool-A only.

 

Thanks in advance.

 

  • Try this:

    when HTTP_REQUEST
    {
        switch [IP::addr [IP::remote_addr]]
        {
            case "172.16.10.0/24" -
            case "172.16.20.0/24" {
                pool Pool-A
            }
            case "172.16.30.0/24" -
            case "172.16.40.0/24" {
                pool Pool-B        
            }
            case "172.16.50.0/24" -
            case "172.16.60.0/24" {
                pool Pool-C
            }
            default {
                pool Pool-A
            }
        }
    }
    

    If you have any more questions, I am sure I can help.