Forum Discussion
Mariusz_B
Nimbostratus
Feb 02, 2015Address Data Group with switch option in iRule.
Hello,
I have the following iRule:
when DNS_REQUEST {
switch [IP::remote_addr] {
Client 1
"10.10.10.0/24" {
if {[LB::status vs Client1] eq "up" } {
host 1.1.1.1
} else {
host 2.2.2.2
}
}
"10.10.20.0/24" {
if {[LB::status vs Client1] eq "up" } {
host 1.1.1.1
} else {
host 2.2.2.2
}
}
"10.10.30.0/24" {
if {[LB::status vs Client1] eq "up" } {
host 1.1.1.1
} else {
host 2.2.2.2
}
}
Client 2
"10.20.10.0/24" {
if {[LB::status vs Client2] eq "up" } {
host 1.1.1.1
} else {
host 2.2.2.2
}
}
"10.20.20.0/24" {
if {[LB::status vs Client2] eq "up" } {
host 1.1.1.1
} else {
host 2.2.2.2
}
}
"10.20.30.0/24" {
if {[LB::status vs Client2] eq "up" } {
host 1.1.1.1
} else {
host 2.2.2.2
}
}
}
}
Is it possible to use address group list instead of network subnet, so I can have only one "if" statement per client?
Regards
Mariusz
1 Reply
- Michael_Jenkins
Cirrostratus
Best way may be like this...
when DNS_REQUEST { Get the status switch [IP::remote_addr] { "10.10.10.0/24" - "10.10.20.0/24" - "10.10.30.0/24" { set status [LB::status vs Client1] } "10.20.10.0/24" - "10.20.20.0/24" - "10.20.30.0/24" { set status [LB::status vs Client2] } } Handle the status if {$status equals "up"} { host 1.1.1.1 } else { host 2.2.2.2 } }
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
