Forum Discussion

annielee_5314's avatar
annielee_5314
Icon for Nimbostratus rankNimbostratus
Mar 13, 2008

HA in irule

 

Hi Experts,

 

 

Need advise on how to write the irule for the below requirement :

 

 

Source A

 

Source B

 

VIP A

 

Destination A

 

Destination B

 

 

Need to write an irule for the following rules :

 

 

- Source A access VIP A, F5 will pass to Destination A,

 

- Source B to Destination B,

 

- when Destination A is down, Source A will goto Destination B

 

- when Destination B is down, Source B will goto Destination A

 

 

Thanks in advance..
  • Assuming it's an HTTP request

     

     

    I would create 2 pools

     

     

    poolA - Destination A priority 100 ratio 1 and Destination B priority 50 ratio 1 with 1 minimum member active <== Destination A is active and Destination B takes over when A fails

     

    PoolB - Destination B priority 50 ratio 1 and Destination A priority 50 ratio 1 with 1 minimum member active <==Destination B is active and Destination A takes over when B fails.

     

     

    Here is how I would probably write the code

     

     

    
    when HTTP_REQUEST {
         switch [IP::client_addr] {
           192.168.1.1 { pool poolA }
           192.168.1.2 { pool poolB }
        }
    }

     

     

    Of course this assumes you know source A and source B. If your sources start to get bigger or change into specific networks then you might want to

     

     

     

    when CLIENT_ACCEPTED {

     

    if {[IP::addr [IP::client_addr] equals 192.168.1.0/24]} {

     

    pool poolB

     

    } {

     

    else if { do something }

     

    }

     

     

     

    I hope that helps

     

     

    CB