Forum Discussion

mahfuz710's avatar
mahfuz710
Icon for Nimbostratus rankNimbostratus
Mar 13, 2024

Multiple iRule

Assalamu Alaikum, I have one VS of four app servers and using ratio algorithm. My client size is more than 20k for pick hour. Now i want to make three irules so specific clients IP get server A, some of clients get Server B and rest of client get server C. Is it possible to set three irules for a single VS and is it wise ? Just let me know ...grateful to you.

Thanks

Mahfuz

1 Reply

  • Hi mahfuz710 ,

    You can create a single rule to achieve the requirement. Create a datagroup to define the client ip and based on it either select the pool or pool member.

    First rule is to select different pool based on the client ip

    when CLIENT_ACCEPTED {     
        if { [class match [IP::client_addr] equals datagroup1] } {        
            pool pool1             
            log local0. "[IP::client_addr] is 1"            
        } elseif { [class match [IP::client_addr] equals datagroup2] } {        
            pool pool2             
            log local0. "[IP::client_addr] is 2"            
        } else {        
             pool pool3              
             log local0. "[IP::client_addr] is 3"
        } 
    }

    Below is to select pool member based on the client ip

    when CLIENT_ACCEPTED {     
        if { [class match [IP::client_addr] equals datagroup1] } {        
            pool pool1 member 10.10.10.11 80            
            log local0. "[IP::client_addr] is 1"            
        } elseif { [class match [IP::client_addr] equals datagroup2] } {        
            pool pool1 member 10.10.10.12 80            
            log local0. "[IP::client_addr] is 2"            
        } else {        
             pool pool1 member 10.10.10.13 80             
             log local0. "[IP::client_addr] is 3"
        } 
    }