Forum Discussion
iRule is giving bracket errors but cant find it were.
Written iRule with help of if & elseif condition. Please check & let us know if any confusion.
when DNS_REQUEST {
if { [IP::addr [IP::remote_addr] equals 192.168.163.0 mask 255.255.255.0]} {
if {[LB::status vs 192.168.163.39 ] eq "up" } {
host 192.168.163.39 }
else {
host 192.168.204.45 }
elseif { [IP::addr [IP::remote_addr] equals 192.168.165.0 mask 255.255.255.0]} {
if {[LB::status vs 192.168.163.39] eq "up" } {
host 192.168.163.39 }
else {
host 192.168.204.45 }
elseif { [IP::addr [IP::remote_addr] equals 192.168.204.0 mask 255.255.255.0]} {
if { [LB::status vs 192.168.204.45] eq "up" } {
host 192.168.204.45 }
else {
host 192.168.163.39 }
}
}
}
hope it will help
- ggarza_345867Jul 24, 2018
Nimbostratus
Still doesn't work, still getting close bracket errors.. I'm trying to use the switch command to create three separate checks on source IP's
when DNS_REQUEST { switch [IP::remote_addr] { "192.168.163.0/24 “ { if { [LB::status vs 192.168.163.39] eq "up" } {
- Samir_Jha_52506Jul 24, 2018
Noctilucent
Can you please try now...
when DNS_REQUEST { switch [IP::remote_addr] { "192.168.163.0/24 “ { if { [LB::status vs 192.168.163.39] eq "up" } { host 192.168.163.39 } else { host 192.168.204.45 } } "192.168.165.0/24] " { if { [LB::status vs 192.168.163.39] eq "up" } { host 192.168.163.39 } else { host 192.168.163.39 } } "192.168.204.0/24] " { if { [LB::status vs 192.168.204.45] eq "up" } { host 192.168.204.45 } else { host 192.168.163.39 } } }
- ggarza_345867Jul 24, 2018
Nimbostratus
Nope..still failing the iRule editor. I was getting some closed bracket errors, I added couple more at end to clear up. But now getting "invalid list element in quotes followed by "up" instead of space
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