cancel
Showing results for 
Search instead for 
Did you mean: 

iRule with multiple if condition Issue

Hello, I am very beginner to iRule creation. In GTM I tried to create irule as below. But getting error.

 

Our intention is we need to reroute the DNS query to different pool based on client IP and pool availability.

 

Appreciate any help on this.

 

when DNS_REQUEST {

 

if { [IP::addr [IP::client_addr] equals 10.222.152.101/32] or [IP::addr [IP::client_addr] equals 10.222.152.104/32]} and {[active_members LDAP_POOL1_PROD] > 0 } {

     then pool LDAP_POOL1_PROD

   } elseif { [IP::addr [IP::client_addr] equals 10.235.4.74/32] or [IP::addr [IP::client_addr] equals 10.235.4.75/32]} and {[active_members LDAP_POOL2_PROD] > 0 } {

      then pool LDAP_POOL2_PROD

   }

   else {

      pool LDAP_POOL3_PROD

     }

}

2 REPLIES 2

Samir
Nacreous
Nacreous

I have corrected the syntax only. Not checked any other conditions.

when DNS_REQUEST { if { ([IP::addr [IP::client_addr] equals 10.222.152.101] or [IP::addr [IP::client_addr] equals 10.222.152.104]) and ([active_members LDAP_POOL1_PROD] > 0) } { pool LDAP_POOL1_PROD } elseif { ([IP::addr [IP::client_addr] equals 10.235.4.74] or [IP::addr [IP::client_addr] equals 10.235.4.75]) and ([active_members LDAP_POOL2_PROD] > 0) } { pool LDAP_POOL2_PROD } else { pool LDAP_POOL3_PROD } }

 

Hello Samir,

 

Thank you very much for your help on this. 😊