Forum Discussion

andre_4691's avatar
andre_4691
Icon for Nimbostratus rankNimbostratus
Jul 07, 2008

source grouping

Dear All,

 

 

Anybody have ever experienced create irules to select server based on source IP Address ?

 

 

Example:

 

IP A will send to Server A as a primary server.

 

IP A will send to Server B as a backup server incase Server A is down.

 

 

IP B will send to server B as a primary server.

 

IP B will send to server A as a backup server incase Server B is down.

 

 

thanks for your help.

 

 

Regards,

 

 

2 Replies

  • Hi,

    You can use priority groups to state that server A is used unless it's down. In that case, server B would be used. You can use a rule like the following to evaluate the client IP address:

     
     when CLIENT_ACCEPTED { 
      
        if {[IP::addr [IP::client_addr] equals 1.1.1.1]}{ 
      
           log local0. "[IP::client_addr]:[TCP::client_port] matched 1.1.1.1" 
           pool server_a_then_b 
      
        } elseif {[IP::addr [IP::client_addr] equals 2.2.2.2]}{ 
      
           log local0. "[IP::client_addr]:[TCP::client_port] matched 2.2.2.2" 
           pool server_b_then_a 
      
        } else { 
      
            Take some default action? 
           log local0. "[IP::client_addr]:[TCP::client_port] default" 
           pool default_pool 
        } 
     } 
     

    You can use IP::addr (Click here) to test for a single host or network, and a datagroup and the matchclass command (Click here) to test for multiple hosts and/or networks.

    Aaron
  • hi,

     

     

    thanks for the answer. I am eager to try out, thxs a lot