Forum Discussion
Mariusz_B
Nimbostratus
Feb 17, 2015iRule - wrong variable definition ?
Hi all,
I have the following iRule, which in terms of syntax is fine:
when DNS_REQUEST {
switch [IP::remote_addr] {
"10.10.1.32/27" -
"10.10.1.64/27" -
"10.10.1.16...
Mariusz_B
Nimbostratus
Feb 27, 2015Hello all,
Sorry for the delay with my feedback and thank you everyone for help. I managed to get some help from highly skilled iRule engineer, and below I am placing the final version. The biggest advantage of the iRule is that adding more clients, doesn't require any code modification. All I have to do is to modify 2 data groups; one called Clients_IPs (which is going to be universal, and which will be created for each wide IP.
when DNS_REQUEST {
set mon "[class match -value [IP::remote_addr] equals Clients_IPs]"
set ip "[class match -value [DNS::question name] equals www.test.com_IP]"
if { ( $mon ne "" ) && ( $ip ne "" ) } {
if {[LB::status vs $mon up]} {
host [getfield $ip "," 1]
} else {
host [getfield $ip "," 2]
}
}
}Regards
Mariusz
JRahm_128324
Feb 27, 2015Historic F5 Account
nice! I try to keep logic in the iRule, data in data-groups personally, but during development for rapid prototyping I put the data in the iRule in if/else or switch conditions.For simple situations where the list won't grow beyond a few entries, if/else or switch is fine.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
