Forum Discussion
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
}
}
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. 😊
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com