Forum Discussion
How to inherit a generic irules?
I need to create hundreds of irule on GTM box like below. (one rule for each webserver). the only difference will be name of the webservers.
when DNS_REQUEST {
if {[DNS::rrtype] eq "A" and [active_members webserver1-pool] > 0} {
webserver1-pool
pool
} elseif {[DNS::rrtype] eq "AAAA" and [active_members webserver1-pool-v6]> 0} {
webserver1-pool-v6
pool
}
}
if
{[DNS::rrtype] eq "A" and [active_members $pool4] > 0} {
pool $pool4
}
elseif {[DNS::rrtype] eq "AAAA" and [active_members $pool6] > 0} {
pool $pool6
}
}
How can I write the rule to inherit this
generic-v6-irules so I can get the equivalent like the first irule? any suggestions? Thanks in advance!
2 Replies
- Hamish
Cirrocumulus
I think I see what youre after. Use a datagroup as a lookup table. You use the webserver as the key and the pool as the value (Or you could encode several parameters in the value as for example colon delimited). The class command then does the lookup for you.
H - Jeff_92092
Nimbostratus
Here is an easy solution which works perfectly to my expection.
Create 1 irules for each webserver
server1-rules
when DNS_REQUEST {
set pool4 "server1-pool-v4"
set pool6 "server1-pool-v6"
}
I already created generic-v6-irules
when DNS_REQUEST {
if {[DNS::rrtype] eq "A" and [active_members $pool4] > 0} {
pool $pool4
} elseif {[DNS::rrtype] eq "AAAA" and [active_members $pool6] > 0} {
pool $pool6
}
}
Then apply both server1-rules and generic-v6-irules to the wide IP.
(server1-rules needs to be in front of generic-v6-irules. so pool4 and pool6 are defined)
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
